Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ask a New Question

Posted on 2009-05-03
1
Medium Priority
?
843 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

718 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