Dear all,

I have used the Apache log4cxx framework in my application, and everything
is fine. I am on Solaris 8, and am using GNU g++ 3.3.2 and Solaris ld 5.9 to
build my application. There is no problem at all.

However, recently I moved the application sources to Linux (Redhat Linux)
and found that the application was not being built there. There were a lot
of linker errors regarding undefined symbols, all related to log4cxx. The
environment there is: g++ 3.4.5 and GNU ld 2.15.

Therefore, the only difference is while in first case, I used Solaris ld,
here I have GNU ld. Does it matter?

I did not give up and further investigated. For this, I wrote a minimal
program using the log framework, and still no success. The minimal code
snippet is given below:

LoggerPtr logger = Logger::getLogger(_T("root"));
int main()
{
        USES_CONVERSION;

        const String & propertyFileName = "logconf.txt";
          PropertyConfigurator::configure(propertyFileName);

        return 0;
}


This did not work still, when I tried to link [-L and -l switches are
correct]

g++ -c -I/home/ambarish/softwares/log4cxx_097/include -o main.o main.cpp
g++ -o log -lpthread -L/home/ambarish/softwares/log4cxx/lib -llog4cpp main.o


main.o(.text+0x195): In function `main':
: undefined reference to
`log4cxx::PropertyConfigurator::configure(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
main.o(.text+0x26d): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to `log4cxx::Logger::getLogger(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'

Any pointers will be extremely helpful. The exact same code works in Solaris
- can the differnt ld be a cause? If anyone has faced such a situation
before, please guide. 

Regards,
Ambarish.

<<attachment: winmail.dat>>

Reply via email to