I meant using the "Static Debug" Configuration when you build the trivial application. It has the settings to work with a static log4cxx library. Effectively it does this: - Set the LOG4CXX_STATIC definition in the Preprocessor Definitions (which, when missing will give you the __declspec(dllimport) errors. log4cxx.lib uses the dll by default) - Set the library dependency to "log4cxxs.lib" - For trivial to link, you will also need to add the following to the library dependency: Ws2_32.lib (winsock).
----- Original Message ----- From: "Lars Schouw" <[EMAIL PROTECTED]> To: "Log4CXX User" <[email protected]> Sent: Thursday, May 20, 2004 11:27 AM Subject: Re: Linking static libs under VC7.1 does not work > Lennart > > I just tried again rebuilding the static lib in debug > mode linking it into the trivial application. > I still get the same error. > > I checked the settings again. I am suspecting that it > does not know the __declspec(dllimport) stuff. > Is there any place in the trivial project where this > has been defined to use dll? > The defines are these: WIN32;_DEBUG;_CONSOLE > which looks harmless to me. > > Build Log ------- Build started: Project: > trivial, Configuration: Debug|Win32 ------- > > Command Lines Creating temporary file > "c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp" > with contents > [ > /OUT:"../Bin/Debug/trivial.exe" /INCREMENTAL:NO > /NOLOGO > /LIBPATH:"C:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug" > /DEBUG /PDB:".\Debug/trivial.pdb" /SUBSYSTEM:CONSOLE > /MACHINE:X86 log4cxxs.lib kernel32.lib user32.lib > gdi32.lib winspool.lib comdlg32.lib advapi32.lib > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib > odbccp32.lib > "\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug\log4cxxs.lib" > ".\Debug\trivial.obj" > ] > Creating command line "link.exe > @"c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp"" > Output Window Linking... > LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' > due to '/INCREMENTAL:NO' specification > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::fatal(class std::basic_string,class > std::allocator > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::error(class std::basic_string,class > std::allocator > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::warn(class std::basic_string,class > std::allocator > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V? [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::info(class std::basic_string,class > std::allocator > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V? [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::debug(class std::basic_string,class > std::allocator > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: static void > __cdecl log4cxx::NDC::push(class > std::basic_string,class std::allocator > const &)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V?$all [EMAIL PROTECTED]@2@@std@@@Z) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT __cdecl > log4cxx::Logger::getRootLogger(void)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@he [EMAIL PROTECTED]@XZ) > referenced in function _main > trivial.obj : error LNK2019: unresolved external > symbol "__declspec(dllimport) public: static void > __cdecl log4cxx::BasicConfigurator::configure(void)" > ([EMAIL PROTECTED]@log4cxx@@SAXXZ) > referenced in function _main > ../Bin/Debug/trivial.exe : fatal error LNK1120: 8 > unresolved externals > Results Build log was saved at > "file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.h tm" > trivial - 9 error(s), 1 warning(s) > > Lars Schouw > Tokyo > > --- Lennart Goedhart <[EMAIL PROTECTED]> wrote: > > I just tried them (I have VC7.1 also), and it worked > > fine. > > Are you selecting the "Static Debug" Configuration > > when you build? > > ----- Original Message ----- > > From: Lars Schouw > > To: Log4CXX User > > Sent: Wednesday, May 19, 2004 5:36 PM > > Subject: Linking static libs under VC7.1 does not > > work > > > > > > I just tried to link the trivial example project > > with the static build library log4cxxs.lib but get a > > link error. > > > > I am using log4cxx version 0.9.7. > > > > Any ideas? I want to use the static library in > > my real application. > > > > ------ Build started: Project: trivial, > > Configuration: Debug Win32 ------ > > > > Linking... > > > > LINK : warning LNK4075: ignoring > > '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' > > specification > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: void > > __thiscall log4cxx::Logger::fatal(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &,char const *,int)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: void > > __thiscall log4cxx::Logger::error(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &,char const *,int)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: void > > __thiscall log4cxx::Logger::warn(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &,char const *,int)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V? [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: void > > __thiscall log4cxx::Logger::info(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &,char const *,int)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V? [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: void > > __thiscall log4cxx::Logger::debug(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &,char const *,int)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V [EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: static void > > __cdecl log4cxx::NDC::push(class > > std::basic_string<char,struct > > std::char_traits<char>,class std::allocator<char> > > > const &)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@V?$all [EMAIL PROTECTED]@2@@std@@@Z) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: static class > > log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> > > __cdecl log4cxx::Logger::getRootLogger(void)" > > > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@he [EMAIL PROTECTED]@XZ) > > referenced in function _main > > > > trivial.obj : error LNK2019: unresolved external > > symbol "__declspec(dllimport) public: static void > > __cdecl log4cxx::BasicConfigurator::configure(void)" > > ([EMAIL PROTECTED]@log4cxx@@SAXXZ) > > referenced in function _main > > > > ../Bin/Debug/trivial.exe : fatal error LNK1120: > > 8 unresolved externals > > > > Build log was saved at > > > "file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.h tm" > > > > trivial - 9 error(s), 1 warning(s) > > > > > > > > > -------------------------------------------------------------------------- ---- > > Do you Yahoo!? > > SBC Yahoo! - Internet access at a great low price. > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Domains - Claim yours for only $14.70/year > http://smallbusiness.promotions.yahoo.com/offer
