Menu

Linker error compiling MSVC 7.1 and 8.0

2009-11-16
2013-05-20
  • Santosh Ahuja

    Santosh Ahuja - 2009-11-16

    Need help compiling on MSVC 2005.  I checked out the code from the CVS a while ago and compiling sources in msvc7 directory  and always get the following error in both ( 7.1 and 8.0 )

    log4cpplib.lib(PatternLayout.obj) : error LNK2019: unresolved external symbol "void __cdecl log4cpp::localtime(__int64 const *,struct tm *)" (?localtime@log4cpp@@YAXPB_JPAUtm@@@Z) referenced in function "public: virtual void __thiscall log4cpp::TimeStampComponent::append(class std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,struct log4cpp::LoggingEvent const &)" (?append@TimeStampComponent@log4cpp@@UAEXAAV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABULoggingEvent@2@@Z)

     
  • darkangel

    darkangel - 2009-11-16

    I don't have msvc7 or 7.1 to check, but think that solution is easy. You need to add to msvc log4cpp project Localtime.cpp from src directory.

     
  • Santosh Ahuja

    Santosh Ahuja - 2009-11-17

    Thanks , Actually the testNTEventLog project was generating the error. Once I added the localtime hh/cpp files to the Log4cppLib project . All works okay now.

    On a different note , which lib should one be linking to in their programs  log4cpp.lib or log4cpplib.lib

     
  • Santosh Ahuja

    Santosh Ahuja - 2009-11-17

    They're all linkin to log4cpplib.lib .. Thanks dark-angel.

     
  • darkangel

    darkangel - 2009-11-17

    To work properly you should link with DLL export library unless you really need to link with static version. I think you should link with log4cpp.lib.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.