Fabian Jacquet | 7 May 2010 10:29
Picon

Re: link error in release mode with Visual Studio 2008

Hi,

The project configuration is different between debug and release. In debug you certainly added log4cxx.lib in the field "Linker/Input/Additional dependencies" but you have a drop-down which select the configuration, if you switch to release, I think you don't have log4cxx.lib in "Additional dependencies" .

Don't forget to add the directory of this lib in the field "Linker/General/Additional Library Directories"

log4cxx.lib is not really a static lib. It's only the interface to the dll class and functions.

I hope it help you.

On Fri, May 7, 2010 at 04:00, Jean-Denis Muys <jdmuys <at> mac.com> wrote:
Hi,

I have a Visual Studio 2008 project using log4cxx that links (and runs) fine in Debug mode using the Debug version of log4cxx, but fails to link in Release mode using the release version of log4cxx. Here are the 13 undefined symbols:


1>------ Build started: Project: RepliKator04, Configuration: Release Win32 ------
1>Linking...
1>   Creating library z:\PCdev\RepliKator2004\RK_Demo_2004\plugins\RepliKator04.bundle\contents\windows\RepliKator04.lib and object z:\PCdev\RepliKator2004\RK_Demo_2004\plugins\RepliKator04.bundle\contents\windows\RepliKator04.exp
1>RKConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getTrace(void)" (__imp_?getTrace <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getDebug(void)" (__imp_?getDebug <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getInfo(void)" (__imp_?getInfo <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getWarn(void)" (__imp_?getWarn <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKConnector.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getError(void)" (__imp_?getError <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>4DPlugin.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __stdcall log4cxx::Logger::getRootLogger(void)" (__imp_?getRootLogger <at> Logger <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLogger <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>4DPlugin.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __stdcall log4cxx::Logger::getLogger(char const * const)" (__imp_?getLogger <at> Logger <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLogger <at> log4cxx <at> <at> <at> helpers <at> 2 <at> QBD <at> Z)
1>4DPlugin.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __stdcall log4cxx::BasicConfigurator::configure(void)" (__imp_?configure <at> BasicConfigurator <at> log4cxx <at> <at> SGXXZ)
1>4DPlugin.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __stdcall log4cxx::PropertyConfigurator::configure(class log4cxx::File const &)" (__imp_?configure <at> PropertyConfigurator <at> log4cxx <at> <at> SGXABVFile <at> 2 <at> <at> Z)
1>RKReplikator.connection.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getOff(void)" (__imp_?getOff <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKReplikator.connection.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Level> __stdcall log4cxx::Level::getFatal(void)" (__imp_?getFatal <at> Level <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLevel <at> log4cxx <at> <at> <at> helpers <at> 2 <at> XZ)
1>RKReplikator.connection.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __stdcall log4cxx::Logger::getLogger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?getLogger <at> Logger <at> log4cxx <at> <at> SG?AV?$ObjectPtrT <at> VLogger <at> log4cxx <at> <at> <at> helpers <at> 2 <at> ABV?$basic_string <at> DU?$char_traits <at> D <at> std <at> <at> V?$allocator <at> D <at> 2 <at> <at> std <at> <at> <at> Z)
1>z:\PCdev\RepliKator2004\RK_Demo_2004\plugins\RepliKator04.bundle\contents\windows\RepliKator04.4DX : fatal error LNK1120: 13 unresolved externals
1>Build log was saved at "file://Z:\PCdev\RepliKator2004\Objs\Release\BuildLog.htm"
1>RepliKator04 - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


As I am a Mac developer, not a Windows developer, I feel lost here. What can I do to fix that issue? I really don't get why those symbols would not be defined in Release mode.

Note that my project is not an application, but a Plugin for a third party app.
I link against the DLL version of log4cxx. I'd rather use a static library version, but I failed to build it so, and I could not find detailed instructions on the net to do it.

So for the time being, I am mainly interested in understanding why these link-time errors occur, and in how to fix them.

Thanks and regards.

Jean-Denis



Gmane