You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Vijai Kalyan <vi...@gmail.com> on 2005/06/30 17:46:50 UTC

Unresolved external symbol

Hello,

I am trying to write a few simple programs using log4cxx as a
precursor to using log4cxx full blown.

--------------------

I get the following error:

BasicTest2 error LNK2019: unresolved external symbol "public: void
__thiscall log4cxx::Logger::forcedLog(class
log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const &,class
_STL::basic_string<unsigned short,class _STL::char_traits<unsigned
short>,class _STL::allocator<unsigned short> > const &,class
log4cxx::spi::LocationInfo const &)"
(?forcedLog@Logger@log4cxx@@QAEXABV?$ObjectPtrT@VLevel@log4cxx@@@helpers@2@ABV?$basic_string@GV?$char_traits@G@_STL@@V?$allocator@G@2@@_STL@@ABVLocationInfo@spi@2@@Z)
referenced in function _main


I can't figure out why it would be able to resolve
LogLog::setInternalDebugging but not the logger methods. I even tried
the the following:

wstring msg = "Hello!";
LOG4CXX_INFO(Logger:getRootLogger(), msg);

but that didn't work either. I tried the basic string (std::string)
but I didn't expect to work either and it didn't.

I would appreciate it if someone can point me in the right direction.

thanks,

-vijai.

---------------------

Here is my basic setup:

1. log4cxx built as follows:

ant -Ddebug=true -Dlib.type=static -Dlogchar=wchar_t

since I would like to be able to debug and I intend to compile with unicode.

2. My test program:

// std includes
#include <iostream>
#include <string>

// logger includes
#include <log4cxx/logger.h>
#include <log4cxx/helpers/loglog.h>

// windows specific
#include <tchar.h>

using namespace std;
using namespace log4cxx;
using namespace log4cxx::helpers;

int main(void)
{
	LogLog::setInternalDebugging(true);
	LOG4CXX_INFO(Logger::getRootLogger(),_TEXT("Hello!"));
	wcout<<_TEXT("Well ... at least the darn thang works! ")<<endl;
	return 0;
}

3. Environment

Microsoft Visual C++ 7.1 with 
log4cxxd.lib Ws2_32.lib apr-1d.lib aprutil-1d.lib MsWSock.Lib 
as additional libraries, multi threaded debug dll C runtime libraries
and UNICODE character set with the path to the libraries defined.