On Jun 14, 2008, at 8:24 AM, Dale King wrote:

On Sat, Jun 14, 2008 at 2:51 AM, srkraju <[EMAIL PROTECTED]> wrote:
Though its giving the same error.
I downloaded Ant-1.6.5. and extracted into
/home/facts/Test/apache-ant-1.6.5/ directory.

g++ test.cpp -I/home/facts/Test/apache-log4cxx-0.10.0/src/main/ include
-L/home/facts/Test/apache-ant-1.6.5/lib/

-L tells the linker where to look for libraries. You have to actually
specify what libraries to look for as well using the -l option.

So if your directory had libfoo.so in it that you needed to link with,
you would add -l foo to your command line.


Apache Ant is a build tool implemented in Java. You are placing the library directory of that product which contains only Java .jar files in the search path of a linker command that operates on .so, .a, .la or the like. That accomplishes nothing. log4cxx does provides for itself both autotools build script (the common approach for Unix environments) and an Ant based build script that is used for Unix and other platforms. However, what build script used to build your application is independent.

What you likely should do is run:

cd apache-log4cxx-0.10.0
make
sudo make install

which will build log4cxx and then "install" it to /usr/local/lib.

Then you should be able to do:

g++ test.cpp -llog4cxx

(unlikely, but if it can't find log4cxx add a -L/usr/local/lib).

Reply via email to