![]() |
| | #1 |
| Not stupid, just stupider Join Date: May 2007 Location: Earthland
Posts: 191
| Code: #ifndef MESSAGE_H_
#define MESSAGE_H_
#include "globaltypes.h"
// MESSAGE LIST
enum MSG
{
MSG_NONE = 0, // default
MSG_FAIL = 0, //
MSG_SUCCESS = 1, //
MSG_OK = 1, //
MSG_ERROR, // string of error message
MSG_WARNING, // string of warning message
MSG_TOTALMESSAGETYPES
};
class MESSAGE
{
public:
MESSAGE();
~MESSAGE();
bool Dispatch( MSG Type, void *Data = NULL );
bool DispatchOne( MSG Type, void *Data, UINT16 Number );
bool DispatchThis( MSG Type, void *Data = NULL );
virtual bool Device( const MSG Type, const void *Data );
private:
UINT16 NumberID;
};
class MESSAGE_TOP
{
public:
UINT16 Add( MESSAGE* pDevice );
bool Dispatch( MSG Type, void *Data = NULL );
bool DispatchOne( MSG Type, void *Data, UINT16 Number );
MESSAGE* Get( const UINT16 Number ) const;
UINT16 Remove( const UINT16 Number );
void RemoveAll();
UINT16 Size() const;
private:
std::vector< MESSAGE* > Device;
} extern Message; // THIS IS CAUSING PROBLEMS HERE!!!
#endif
Code: error LNK2001: unresolved external symbol "class MESSAGE_TOP Message" (?Message@@3VMESSAGE_TOP@@A) Code: error LNK2005: "class MESSAGE_TOP Message" (?Message@@3VMESSAGE_TOP@@A) already defined Thanks. |
| yaya is offline | |
| | #2 |
| Staff software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 6,014
| Do you actually declare "MESSAGE Message;" in any .cpp file anywhere? An extern on its own is not enough. The extern just tells the rest of the code to expect that symbol to be present at link-time, but doesn't create the symbol. Also, I'd recommend separating out the extern declaration from the class declaration: Code: class MESSAGE
{
...
};
extern MESSAGE Message;
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot |
| brewbuck is offline | |
| | #3 |
| Not stupid, just stupider Join Date: May 2007 Location: Earthland
Posts: 191
| Yes, that got it... thankyou. |
| yaya is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linker Errors in OpenGL | Sentral | Game Programming | 2 | 07-19-2005 04:29 PM |
| Linker errors - Multiple Source files | nkhambal | C Programming | 3 | 04-24-2005 02:41 AM |
| help, linker errors when adding library file to project | ngcfan525 | C++ Programming | 1 | 03-09-2003 02:27 PM |
| Linker errors with simple static library | Dang | Windows Programming | 5 | 09-08-2001 09:38 AM |