I am using Redhat Linux AS5, with g++ version 4.1.1
I compiled log4cxx0.10.0.tar.gz, apr-1.2.2, apr-util-1.2.2 Everything is successful. (configure, make, make check) When I run a sample program, with log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("com.foo")); in main function and tried to compile it with g++ -I/home/facts/Test/apache-log4cxx-0.10.0/src/main/include/ test.cpp Source (test.cpp) #include "log4cxx/logger.h" #include "log4cxx/basicconfigurator.h" #include "log4cxx/propertyconfigurator.h" #include "log4cxx/helpers/exception.h" using namespace log4cxx; using namespace log4cxx::helpers; int main(int argc, char **argv) { log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("com.foo")); return 0; } its giving the following error /tmp/ccFOKkNH.o: In function `main': test.cpp:(.text+0x21): undefined reference to `log4cxx::Logger::getLogger(char const*)' /tmp/ccFOKkNH.o: In function `log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT()': test.cpp:(.text._ZN7log4cxx7helpers10ObjectPtrTINS_6LoggerEED1Ev[log4cxx::he lpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT()]+0x40): undefined reference to `log4cxx::helpers::ObjectPtrBase::~ObjectPtrBase()' test.cpp:(.text._ZN7log4cxx7helpers10ObjectPtrTINS_6LoggerEED1Ev[log4cxx::he lpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT()]+0x59): undefined reference to `log4cxx::helpers::ObjectPtrBase::~ObjectPtrBase()' /tmp/ccFOKkNH.o: In function `log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT()': test.cpp:(.text._ZN7log4cxx7helpers10ObjectPtrTINS_6LoggerEED0Ev[log4cxx::he lpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT()]+0x40): undefined reference to `log4cxx::helpers::ObjectPtrBase::~ObjectPtrBase()' ........ I understand that it's unable to locate the function in libraries. But there were no shared objects generated. How can resolve this? thanks& regards srkraju DISCLAIMER “The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"