|
If you've set /nodefaultlibs, try to scrap it.
- It's easier to make than to correct a mistake.
|
|
|
|
|
|
Anybody else have any ideas on where to go from here?
It really seems like the info from <string> is getting stepped on or something.
Help I'm totally stuck!!
Thanks,
Jim
|
|
|
|
|
Would it make a difference that I have both C & CPP files in this project?
|
|
|
|
|
My class h file is
class CScale : public CStatic
{
public:
CScale();
public:
public:
public:
protected:
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
public:
CFont m_font;
COLORREF *BC, BGC;
protected:
afx_msg BOOL OnPaint(CDC* pDC);
DECLARE_MESSAGE_MAP()
};
I have all the function bodies in the cpp file.
When I compile I get:
GraphCtrl.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CScale::GetMessageMap(void)const " (?GetMessageMap@CScale@@MBEPBUAFX_MSGMAP@@XZ)
Release/RunCadMFCDLL.dll : fatal error LNK1120: 1 unresolved externals
thanks for helping,
sb
|
|
|
|
|
Do you have BEGIN_MESSAGE_MAP() in your class' .cpp file?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Duh!
I made the cpp file from scratch (the class wizard didn't make it), and I did not even think about the message map section needing to be in there (though I know its always there. thanks to both of you - you diagnosed it right away
sb
|
|
|
|
|
It seems that for your CScale control there is no corresponding BEGIN_MESSAGE_MAP /END_MESSAGE_MAP zone (created by Class Wizard) in CPP file.
Open the CPP file where the implementation of CScale class is provided, and check if there is a BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros here, something like this:
BEGIN_MESSAGE_MAP(CScale, CStatic)
END_MESSAGE_MAP()
In addition, check if your CPP file is included in the project, i.e. is listed in the Solution Explorer panel, and is not excluded from build process.
Hope it helps.
|
|
|
|
|
What the others have said, and also, if you want ClassWizard to work correctly, you need to make all this stuff match ...
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphCtrl)
should be
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CScale)
Be careful what you cut and paste - don't forget the edit!
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
When I declare a member static in a class, it throws a linker error stating it's an unresolved external symbol..
Error Message:
<br />
CTimp error LNK2001: unresolved external symbol "public: static char * CAvCT::m_szApplicationName" (?m_szApplicationName@CAvCT@@2PADA)<br />
When I make it non-static, it works fine. Why is that so??
Please help.
The member is declared public. i.e :
<br />
public:<br />
static int x;<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
you still need to define the variable:
foo.h
CFoo
{
public:
static int blah;
};
foo.cpp
#include "foo.h"
int CFoo::blah = 0;
|
|
|
|
|
Chris now a different version of it.
But is it not obvious that you are declaring it again ? in the .cpp file?
<br />
AvCT.cpp(16): error C2086: 'int CAvCT::xxx' : redefinition<br />
<br />
AvCT.cpp(16): error C2655: 'CAvCT::xxx' : definition or redeclaration illegal in current scope<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
The difference between a static and a non-static variable is that the static variable will be shared among all instances of the class (so, it doesn't belong to a specific instance). Because of that, declaring it inside the class is not sufficient, you need to define it outside in the cpp file. If you try to do the same with a non-static variable, you'll get an error because declaring the variable in the class is sufficient.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
VuNic wrote: But is it not obvious that you are declaring it again ? in the .cpp file?
since i can't see your code, i don't know what you're doing here and can't explain the error (did you remove the "static" in your .H?).
but, static member variables require both parts: the declaration and the definition (as my first reply and all the other replies to your question show) . without the .CPP part, your variable has no space allocated for it - since it's not part of a class instance, you have to give it a place to live outside the class.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Got it! thanks chris!
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
When you declare a static data member (in *.h file), you should also implement it in the *.cpp file:
class MyClass
{
static int x;
};
int MyClass::x;
So you missed to allocate the space for your static variable. Just a declaration of static data members is not enough.
|
|
|
|
|
VuNic wrote: static int x;
Has x been initialized/defined (in the .cpp file)?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, I declared it in the .h file, and initialzed in the constructor.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Just because it has been declared does not mean it has been defined. Define x in the class' .cpp file. Static members are initialized outside of any class methods (e.g., file scope).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
First off, Sorry!, Time is running out for me , so out of panic, I wasn't quite listening to you guys completely. I should have put the definition of the static member again in the .cpp. I did it wrong doing it inside the constructor or a function. Now I put it out side the constructor. It's fine now.
<br />
#include <class.h><br />
int class::x;
void class::class()<br />
{<br />
int class::x;
}<br />
void class::func()<br />
{<br />
<br />
}<br />
Thanks, CL, David, viorel, cederic.. and SORRY FOR THE LATE ACKNOWLEDGEMENT . Need to rush.. thanks a lot.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Hello!,
I need to code a program that works in UNIX and dos there I can use text color, green, red and so on. How can I do that?
the text I need to put on the screen need to be in color.
|
|
|
|
|
Well, VT/XTerm color codes can be used to write in color to a (supported) Unix console. I would suggest using something like the curses library for that, but it has been quite some time since I did any console-coloring so some other libraries may be around.
If you only need to run the app on Unix but access it from DOS (do you mean a Win32 Console?) and Unix, so that there is only one platform to build for, use curses and connect to it using a terminal emulator that supports ANSI/XCode color codes.
If you need to build for Unix and Windows, I would suggest that you use the Console Functions in Win32 to do coloring in the Windows/Console build.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hey that's a cool work to do.. settextcolor() If remember it correctly. I dont know about UNIX though. And I'm talking about Borland C++ complier.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
In VC :
SetConsoleTextAttribute ( m_hConsole,<br />
FOREGROUND_RED |<br />
FOREGROUND_GREEN |<br />
FOREGROUND_BLUE );
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Hi All,
How to enter only Hexadecimal values in EditBox in Dialog?
Thanks in Advance.
|
|
|
|