Hi Betty,
The Makefiles in log4cpp are automatically generated from the
Makefile.am files by automake/autoconf. Editting a Makefile.am will only
work if you have the automake and autoconf packages installed. Also the
target 'testCategory', etc. will not be build if you type just 'make',
since the are not part of the default make target. (you need to do 'make
check'.)
So to get started it's probably easier to try the hand written
one-liner. You almost got it right, except for two things:
1) Since the source is C++ use 'g++' instead of 'gcc' or else the
compiler won't link the necessary standard C++ libraries
2) It does link the log4cpp library.
I assume you've build and installed log4cpp
using './configure --prefix=<installdir> ; make ; make install'
Then you can ask the tool log4cpp-config which parameters you need for
linking log4cpp with 'log4cpp-config --libs'.
It will return something like '-L<installdir> -llog4cpp', maybe followed
by '-lsocket -lnsl' or something similar.
The same trick also works for the compile flags.
In short, try:
g++ `log4cpp-config --cflags` `log4cpp-config --libs` -o testLog
testLog.cpp
Good luck,
Bastiaan Bakker
LifeLine Networks bv
On Fri, 2002-12-13 at 11:05, Betty Goh wrote:
> Dear all,
>
> This is really basic level question, but I couldn't find the answer anywhere in the list. So hopefully someone's coming to my rescue as I'm really clueless as to how to compile. :)
>
> I've written a simple program (basically copied from a technical article from the Solaris Developer Connection). But I have no idea as to how to compile it.
>
> I tried adding it to the tests directory and modified the Makefile to include my source code, it doesn't work. The Makefile simply ignores my source code.
>
> Then I tried doing a one-liner like this:
> gcc -DHAVE_CONFIG_H -I. -I/home/bgoh2/log4cpp-0.3.4b/tests -I/home/bgoh2/log4cpp-0.3.4b/include
> -I/home/bgoh2/log4cpp-0.3.4b/src testLog.cpp
>
> I get a lot of undefined references to the .hh files, which is strange because the files are all there.
>
> I would be really grateful if someone can point me in the right direction.. :)
>
> Many thanks,
> Betty
> --
> Get your free email from www.doramail.com with 30 Megs of disk space in webhosting and e-mail storage!
>
>
>
>
>
> Powered by Outblaze
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> _______________________________________________
> Log4cpp-devel mailing list
> Log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4cpp-devel
|