logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Balbinot <rbalbi...@gmail.com>
Subject Problems using log4cxx.lib with VS2008 (link problems with applications)
Date Thu, 18 Feb 2010 02:15:37 GMT
I'am using log4cxx with g++ for about one and a half year, without any
problema at all...

But now I have to develop something in Windows, and I must use VS2008...

I read a lot of messages in the list, and I get that I have to build the
library as a static library, but I do think I am not doing it the proper
way...

Two steps:
1) I build the library itself... I select the static library option, /MTd
and I do set the preprocessor to these values:

OBS: apr, apr_util and xml projects use the /MDd option... I choosed not to
change that at first (at least, no one said it should be done). And I do
guess that is not important at all...
OBS2: note that with VS2008 at least, it is not possible to specify another
libraries that lib4cxx.lib has dependencies... well, the compiler does not
return any error messages anyway... it does build the lib right away...

ORIGINAL VALUES:
_DEBUG
_USRDLL
DLL_EXPORTS
LOG4CXX
APR_DECLARE_STATIC
APU_DECLARE_STATIC
WIN32

First try:
_DEBUG
_USRDLL
DLL_EXPORTS
LOG4CXX_STATIC
APR_DECLARE_STATIC
APU_DECLARE_STATIC
WIN32

Result: a log4cxx.lib file with 37MB

Second try: I delete anything that shows DLL.. :)
_DEBUG
LOG4CXX_STATIC
APR_DECLARE_STATIC
APU_DECLARE_STATIC
WIN32

Result: a log4cxx.lib file with 37MB

It is important to notice that in both cases the library is built by the
compiler with no complaints at all...

2) I try to build my applications..
I do use the LOG4CXX_STATIC preprocessor directive and I do include the
indicated libs... (advapi32.lib, mswsock.lib, shell32.lib, WS2_32.lib,
log4cxx.lib)

OBS: I also tried to insert APR_DECLARE_STATIC and APU_DECLARE_STATIC in the
directives (I guess it is not necessary at all), but with no change...

But no matter what I do, I always get a lot of messages complaining about
apr and apr_util, just like these:
1>log4cxx.lib(serversocket.obj) : error LNK2019: unresolved external symbol
_apr_poll@20 referenced in function "public: class
log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::Socket> __thiscall
log4cxx::helpers::ServerSocket::accept(void)" (?accept@ServerSocket
@helpers@log4cxx@@QAE?AV?$ObjectPtrT@VSocket@helpers@log4cxx@@@23@XZ)
1>log4cxx.lib(socket.obj) : error LNK2019: unresolved external symbol
_apr_socket_connect@8 referenced in function "public: __thiscall
log4cxx::helpers::Socket::Socket(class log4cxx::helpers::ObjectPtrT<class
log4cxx::helpers::InetAddress> &,int)" (??0Socket@helpers@log4cxx@@QAE@AAV
?$ObjectPtrT@VInetAddress@helpers@log4cxx@@@12@H@Z)
1>log4cxx.lib(datagramsocket.obj) : error LNK2001: unresolved external
symbol _apr_socket_connect@8
1>log4cxx.lib(socket.obj) : error LNK2019: unresolved external symbol
_apr_sockaddr_ip_get@8 referenced in function "public: __thiscall
log4cxx::helpers::Socket::Socket(struct apr_socket_t *,struct apr_pool_t *)"
(??0Socket@helpers@log4cxx@@QAE@PAUapr_socket_t@@PAUapr_pool_t@@@Z)
1>log4cxx.lib(inetaddress.obj) : error LNK2001: unresolved external symbol
_apr_sockaddr_ip_get@8

Notice that there are LNK2019 and LNK2001 errors.

Does anyone have any idea on what am I doing wrong?

As I understand those messages the linker is complaining about a function
from apr...... but when I do build the lib4cxx static library, I guess those
apr and apr_util functions are built in together with lib4cxx... I also
tries to simply put the apr and apr_util libs in the lib path, and even
include directly on my project.. no success and no change in behavior...
I did not buils apr and apr_utils before log4cxx, cause (I guess) it is not
necessary.. simply building log4cxx from the VS project does that.

Best regards,
Ricardo

Mime
View raw message