Suhashk
asked on
Ask a New Question
I am supposed to use log4cxx in my application. But this is the first time I am working on logging. So I am trying a win32 console application with the use of log4cxx. (I am using visual studio 2008). I've build log4cxx to get the library files apr.lib, aprutil.lib, log4cxx.lib, xml.lib. Linked these files using 'Additional library directories' option of VS2008. The program compiles fine but when I try to build the code, I am getting
1>LINK : warning LNK4076: invalid incremental status file 'C:\Users\QSS4\Documents\V isual Studio 2008\Projects\ILogEx\Debug \ILogEx.il k'; linking nonincrementally
1> Creating library C:\Users\QSS4\Documents\Vi sual Studio 2008\Projects\ILogEx\Debug \ILogEx.li b and object C:\Users\QSS4\Documents\Vi sual Studio 2008\Projects\ILogEx\Debug \ILogEx.ex p
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::BasicConfigurator ::configur e(void)" (__imp_?configure@BasicCon figurator@ log4cxx@@S AXXZ) referenced in function "void __cdecl foo(void)" (?foo@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPt rT<class log4cxx::Logger> __cdecl log4cxx::Logger::getLogger (char const * const)" (__imp_?getLogger@Logger@l og4cxx@@SA ?AV?$Objec tPtrT@VLog ger@log4cx x@@@helper s@2@QBD@Z) referenced in function "void __cdecl `dynamic initializer for 'logger''(void)" (??__Elogger@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall log4cxx::helpers::ObjectPt rT<class log4cxx::Logger>::~ObjectP trT<class log4cxx::Logger>(void)" (__imp_??1?$ObjectPtrT@VLo gger@log4c xx@@@helpe rs@log4cxx @@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'logger''(void)" (??__Flogger@@YAXXZ)
1>C:\Users\QSS4\Documents\ Visual Studio 2008\Projects\ILogEx\Debug \ILogEx.ex e : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Users\QSS4\Docu ments\Visu al Studio 2008\Projects\ILogEx\ILogE x\Debug\Bu ildLog.htm "
I've tried putting the log4cxx.dll in the project directory in project directory at level of .sln file, at level of the code files and in debug directory. But I get the same error in all cases. What may be the problem here?
Thanks.
1>LINK : warning LNK4076: invalid incremental status file 'C:\Users\QSS4\Documents\V
1> Creating library C:\Users\QSS4\Documents\Vi
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::BasicConfigurator
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPt
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall log4cxx::helpers::ObjectPt
1>C:\Users\QSS4\Documents\
1>Build log was saved at "file://c:\Users\QSS4\Docu
I've tried putting the log4cxx.dll in the project directory in project directory at level of .sln file, at level of the code files and in debug directory. But I get the same error in all cases. What may be the problem here?
Thanks.
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/helpers/exception.h"
using namespace log4cxx;
#include "iostream"
using namespace std;
LoggerPtr logger(Logger::getLogger("Foo"));
void foo()
{
BasicConfigurator::configure();
cout<<"FOO";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.