help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: log4cxx compilation problem


From: Paul Pluzhnikov
Subject: Re: log4cxx compilation problem
Date: Thu, 27 Jul 2006 13:27:01 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

msosno01@gmail.com writes:

>  In function `main':
>  : undefined reference to `log4cxx::BasicConfigurator::configure()'
>  /home/maksim/tmp/ccvVAxjg.o(.text+0x44): In function `main':
>  : undefined reference to `log4cxx::Logger::getRootLogger()'
>
>
> I included all the header files needed. I think the problem is in how I
>  compile the program.

The problem is in how you *link* the program.

> Maybe I need to include a library?

Most likely.

> The problem is
> that I did not find any libraries in the log4cxx folder.

You probably need to build it first.

If you installed a binary package for the library, use your package
manager to find out where the library itself was installed.

Also, on UNIX there are no folders, only directories.

>  g++ -D_REENTRANT -pipe -O3 -march=i586 -fomit-frame-pointer
>  -I/home/maksim/projects/log4cxx-0.9.7/include -D_GNU_SOURCE
>  -L/usr/local/lib -lccgnu2 -ldl -lrt -pthread *.cpp -o server

That command line is totally backwards.
Libraries ('-lccgnu2', '-ldl', '-lrt') are supposed to *follow*
sources (and objects) on the link line, not preceed them.

To understand why this might be important, read this:
 http://webpages.charter.net/ppluzhnikov/linker.html 

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]