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 Klaus Dums <kd...@sbox.tugraz.at> on 2006/08/04 08:29:04 UTC

build on VS2005, Multi-threaded, static, Linker errors, unresolved external, already defined, Visual Studio 2005

The problem:
    Compile an exe without dependece on any dll ( eg: MSVCP80.DLL).
    Therefore I wanted to compile with option /MT and /MTd. But log4cxx
is compiled with /MD or /MDd to use a dll.
    The build output can be seen if you start ant with '-verbose'.
    So I got loads of linker errors.

The solution:
    Alter files:  apr-build.xml, aprutil-build.xml, build.xml.
    Add to those files in the compiler section the option: runtime="static".
    This changes the compiler option from /MD to /MT.
    Eg:
    --snip--
    <cc name="${compiler}"
                exceptions="true"
                outfile="${log4cxx.lib.dir}/log4cxx${lib-suffix}"
                subsystem="console"
                multithreaded="true"
                outtype="${lib.type}"
                objdir="${log4cxx.lib.dir}/log4cxx_obj"
                debug="${debug}"
                projectsOnly="${projectsOnly}"
                runtime="static">
        --snip--

    Define in Preprocessor Definitions in VS: LOG4CXX_STATIC
    Add Additional Dependencies in VS: log4cxxd.lib apr-1d.lib
aprutil-1d.lib wsock32.lib Ws2_32.lib

kind regards,
klaus dums

PS: I hope this saves someone hours.