Solved

Ask a New Question

Posted on 2009-05-03
1
811 Views
Last Modified: 2012-05-06
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\Visual Studio 2008\Projects\ILogEx\Debug\ILogEx.ilk'; linking nonincrementally
1>   Creating library C:\Users\QSS4\Documents\Visual Studio 2008\Projects\ILogEx\Debug\ILogEx.lib and object C:\Users\QSS4\Documents\Visual Studio 2008\Projects\ILogEx\Debug\ILogEx.exp
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::BasicConfigurator::configure(void)" (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ) referenced in function "void __cdecl foo(void)" (?foo@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __cdecl log4cxx::Logger::getLogger(char const * const)" (__imp_?getLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@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::ObjectPtrT<class log4cxx::Logger>::~ObjectPtrT<class log4cxx::Logger>(void)" (__imp_??1?$ObjectPtrT@VLogger@log4cxx@@@helpers@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.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Users\QSS4\Documents\Visual Studio 2008\Projects\ILogEx\ILogEx\Debug\BuildLog.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.


#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";
}

Open in new window

0
Comment
Question by:Suhashk
1 Comment
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 250 total points
ID: 24293218
>>>> Linked these files using 'Additional library directories' option of VS2008.
You additionally need to add the .lib files to the Linker - Input - Additional Dependencies.

The ''Additional library directories' id only for omitting the folders of these libs.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question