log4cxx is an excellent library for logging with a huge amount features: http://logging.apache.org/log4cxx/manual/Introduction.html My friend persuaded me to install it. However, I have a problem compiling a simple program. This is the program: #include <iostream> #include "server.h"
#include <log4cxx/logger.h> #include <log4cxx/ndc.h> #include <log4cxx/basicconfigurator.h> #include <log4cxx/propertyconfigurator.h> #include <log4cxx/helpers/exception.h> using namespace std; using namespace ost; using namespace log4cxx; using namespace log4cxx::helpers; int main() { int result = EXIT_SUCCESS; try { BasicConfigurator::configure(); LoggerPtr rootLogger = Logger::getRootLogger(); NDC::push(_T("trivial context")); rootLogger->debug(_T("debug message")); rootLogger->info(_T("info message")); rootLogger->warn(_T("warn message")); rootLogger->error(_T("error message")); rootLogger->fatal(_T("fatal message")); } catch(Exception&) { result = EXIT_FAILURE; } return result; } I receive these error messages: 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. Maybe I need to include a library? The problem is that I did not find any libraries in the log4cxx folder. 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 Any help is appreciated (my program also uses GNU common C++ library). _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus