On Jul 15, 2008, at 1:25 AM, Eberhard, Markus (external) wrote:
Hello *,
I ma trying to build log4cxx as static library using MS Visual
Studio 2003, but it doesn’t work. I have opened the project
log4cxx.dsw of the log4cxx package, converted it to a MS Visual
Studio 2003 project, set the project “log4cxx” as start-up project
and changed two properties:
- build “static library” not “dynamic library”
- and the pre-processor definition “LOG4CXX” to “LOG4CXX_STATIC”
When linking during the build process I get 544 warnings like the
followings:
apr-1.lib(dir.obj) : warning LNK4006: [EMAIL PROTECTED] already
defined in aprutil-1.lib(dir.obj); second definition ignored
apr-1.lib(fileacc.obj) : warning LNK4006: [EMAIL PROTECTED]
already defined in aprutil-1.lib(fileacc.obj); second definition
ignored
Linking my own test project with the build static library results in
the following errors:
log4cxx.lib(start.obj) : error LNK2019: unresolved external symbol
[EMAIL PROTECTED] referenced in function [EMAIL PROTECTED]
log4cxx.lib(start.obj) : error LNK2019: unresolved external symbol
[EMAIL PROTECTED] referenced in function [EMAIL PROTECTED]
log4cxx.lib(apr_snprintf.obj) : error LNK2019: unresolved external
symbol [EMAIL PROTECTED] referenced in function _conv_in_addr
log4cxx.lib(sockaddr.obj) : error LNK2001: unresolved external
symbol [EMAIL PROTECTED]
log4cxx.lib(sockaddr.obj) : error LNK2019: unresolved external
symbol [EMAIL PROTECTED] referenced in function _apr_sockaddr_vars_set
…
What have I to do to get the static library running? Please help.
Thanks
Markus
Add advapi32.lib, mswsock.lib, ws2_32.lib and shell32.lib to the
libraries used in the link step. log4cxx.dll is dependent on those
system libraries. When you link with the static library, you also
have to include the libraries dependencies.