On Nov 26, 2007, at 12:38 AM, Vic Simkus wrote:

Hello

I'm using the latest version of log4cxx (sucked down svn HEAD
yesterday).  I'm having a weird problem linking against it.  The
constructor for NTEventLogAppender is not being found (error bellow).
The DLL does export it, I've verified it using the "dependency walker"
(signature bellow).  If I call default constructor it links fine.
Everything else seems to be working OK otherwise for the most part -
i.e. I'm able to link the application and get logging output.  I think
this has to do something with char/w_char/short stuffs, but not quite
sure how to solve it.  This one has me completely stumped.  Any
suggestions?

Oh, this is all under VC2003 with SP1.

Thanks
Vic


log4cxx::nt::NTEventLogAppender::NTEventLogAppender(class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &,class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &,class
std::basic_string<unsigned short,struct std::char_traits<unsigned
short>,class std::allocator<unsigned short> > const &,class
nt::helpers::ObjectPtrT<class log4cxx::Layout> const &)


Error:

main.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall
log4cxx::nt::NTEventLogAppender::NTEventLogAppender(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const  ,class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &,class
log4cxx::helpers::ObjectPtrT<class  log4cxx::Layout> const &)"
([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@DU? [EMAIL PROTECTED]@std@@[EMAIL PROTECTED]@2@@std@@00ABV? [EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@@Z)
referenced in function _main


The log4cxx.dll entry is consistent with a normal Windows build where LogString == std::basic_string<wchar_t>. That is, log4cxx uses wchar_t (which is UTF-16 on Windows) as the internal string representation and all logging requests are converted as necessary to UTF-16.

The linking error appears to expect that LogString == std::basic_string<char> which is the normal Linux default where the char values are UTF-8 and all logging requests are converted as necessary to UTF-8.

This type of linking error would occur if somehow your app was compiled with a log4cxx/log4cxx.h that was not consistent with the DLL's version. For the Microsoft compilers, you would expect that log4cxx/log4cxx.h would just be a copy of log4cxx/log4cxx.hw.

Perhaps running a cygwin or MinGW build on the same checked out copy of source could result in a mismatched log4cxx.h file.

Reply via email to