I am working on creating rLog for assembly as a DLL under windows, and I was getting undefined character errors related to some global characters in the rlog namespace. In particular, this is in RLogChannel.cpp:
namespace rlog {
...
RLogChannel *_RLDebugChannel = GetGlobalChannel( "debug", Log_Debug );
RLogChannel *_RLInfoChannel = GetGlobalChannel( "info", Log_Info );
RLogChannel *_RLWarningChannel = GetGlobalChannel( "warning", Log_Warning );
RLogChannel *_RLErrorChannel = GetGlobalChannel( "error", Log_Error );
...
};
I suggested that the problem was that 1) they were not exported and 2) they were not declared in the header, so that other things could access them. So I added __declspec (dllexport) to them (via the RLOG_DECL macro), and in the header:
namespace rlog {
...
RLOG_DECL extern RLogChannel *_RLDebugChannel;
RLOG_DECL extern RLogChannel *_RLInfoChannel;
RLOG_DECL extern RLogChannel *_RLWarningChannel;
RLOG_DECL extern RLogChannel *_RLErrorChannel;
...
};
But no matter how I declare the variables in RLogChannel.cpp, I get an override error, even though my externing they are in the header ... What is the right way to do this? It sounds like it should be easy, but I can't wrap my head around me.
Edit: error message
Error 12 error C2086: 'rlog::RLogChannel *rlog::_RLDebugChannel' : redefinition rlog-1.4\rlog\RLogChannel.cpp 45 rlog
( 4 )
: , , , ( MSVC...), , -