God forsaken linker errors...
I keep getting a damn linker error in this header file. It seams that it works the first time it is processed but every time I call it again, it pops up with another (of the same) error. Here's the code:
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
The error is on the line towards the end (extern Message). This is the linker error:
Code:
error LNK2001: unresolved external symbol "class MESSAGE_TOP Message" (?Message@@3VMESSAGE_TOP@@A)
And this is the error without the extern in there:
Code:
error LNK2005: "class MESSAGE_TOP Message" (?Message@@3VMESSAGE_TOP@@A) already defined
I've tried all sorts of things but I give up. This is apart of my global header, so it is known to pretty much every other part of the program.
Thanks.