Hi ,
downloaded the log4cpp-1.1.2rc3.tar and I have built the library in Visual Studio 2010. But when I try to build the project "testDLL" provided with the library, I have the following error:
error LNK2019: unresolved external symbol "public: thiscall log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer(void)" (??0AppenderMapStorageInitializer@Appender@log4cpp@@QAE@XZ) referenced in function "void cdecl log4cpp::`dynamic initializer for 'appenderMapStorageInitializer''(void)" (??__EappenderMapStorageInitializer@log4cpp@@YAXXZ)
error LNK2019: unresolved external symbol "public: thiscall log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer(void)" (??1AppenderMapStorageInitializer@Appender@log4cpp@@QAE@XZ) referenced in function "void cdecl log4cpp::`dynamic atexit destructor for 'appenderMapStorageInitializer''(void)" (??__FappenderMapStorageInitializer@log4cpp@@YAXXZ)
I figured out that it is because the AppenderMapStorageInitializer() was not exported in the log4cpp.dll. I fixed it by adding LOG4CPP_EXPORT to the AppenderMapStorageInitializer class (in the Appender.hh file).
Am I the only one with this issue? If not can you fix the problem in the next log4cpp release?
Thanks !
Regards.
Jeremy
Hello Jeremy,
I confirm that the error happens. It'll be fixed in next release.
Thanks for the report.
Alex.
Hi Alexander, I am getting the same error on version 1.1.3 (using as a Nuget package). I am using VS2019 for the development. Can you please look into this, and if possible please provide any workaround or fix ? Thanks in advance.
Abhishek,
Have you tried it before with earlier versions (like Visual Studio 2010)? I wonder whether it is the change in IDE version which causes the error or the fix above is insufficient.
Hi Abhishek,
am using VS 2019 and downloaded it with Nuget package. you need the winsock lib, either you put it by putting ws2_32.lib in Project properties -> Linker-> input -> additional dependys or just add pragma comment(lib,"ws2_32.lib") to your code.