The first set of errors (LNK2005) are probably because the runtime library you compiled log4cxx with is different than the one in your project. For example, if you use C/C++ -> Code Generation -> Runtime Library -> Multi-Threaded Debug DLL (/MDd) in your project, you have to compile log4cxx with the same runtime library. By default the build scripts (e.g. build.xml) use the dynamic runtime.
For the socket errors (LNK2019), add wsock32.lib and ws2_32.lib to Linker -> Input -> Additional Dependencies. You may also be missing other libraries. On 5/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Added the options… Now I have different set of errors. Linking... LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification libcpmt.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" ([EMAIL PROTECTED]@std@@QAEXXZ) already defined in testlog.obj libcpmt.lib(xmutex.obj) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" ([EMAIL PROTECTED]@std@@QAEXXZ) already defined in testlog.obj LIBCMT.lib(mbctype.obj) : error LNK2005: __getmbcp already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(mbctype.obj) : error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(mbctype.obj) : error LNK2005: ___initmbctable already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: ___init_dummy already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: __strcats already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: ___lc_strtolc already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: ___lc_lctostr already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: __expandlocale already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(setlocal.obj) : error LNK2005: _setlocale already defined in LIBCD.lib(setlocal.obj) LIBCMT.lib(initctyp.obj) : error LNK2005: ___init_ctype already defined in LIBCD.lib(initctyp.obj) LIBCMT.lib(initctyp.obj) : error LNK2005: ____mb_cur_max_func already defined in LIBCD.lib(initctyp.obj) LIBCMT.lib(initctyp.obj) : error LNK2005: ____lc_codepage_func already defined in LIBCD.lib(initctyp.obj) LIBCMT.lib(initctyp.obj) : error LNK2005: ____lc_collate_cp_func already defined in LIBCD.lib(initctyp.obj) LIBCMT.lib(initctyp.obj) : error LNK2005: ____lc_handle_func already defined in LIBCD.lib(initctyp.obj) LIBCMT.lib(initnum.obj) : error LNK2005: ___free_lconv_num already defined in LIBCD.lib(initnum.obj) LIBCMT.lib(initnum.obj) : error LNK2005: ___init_numeric already defined in LIBCD.lib(initnum.obj) LIBCMT.lib(initmon.obj) : error LNK2005: ___free_lconv_mon already defined in LIBCD.lib(initmon.obj) LIBCMT.lib(initmon.obj) : error LNK2005: ___init_monetary already defined in LIBCD.lib(initmon.obj) LIBCMT.lib(initmon.obj) : error LNK2005: ___lconv_intl already defined in LIBCD.lib(initmon.obj) Creating library Debug/Test.lib and object Debug/Test.exp LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: __thiscall `anonymous namespace'::WinSockInitializer::WinSockInitializer(void)" ([EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: __thiscall `anonymous namespace'::WinSockInitializer::~WinSockInitializer(void)" ([EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: __thiscall log4cxx::helpers::SocketException::SocketException(void)" ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::accept(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::SocketImpl>)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::accept(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::SocketImpl>)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(inetaddress.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::accept(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::SocketImpl>)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::accept(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::SocketImpl>)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::close(void)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@QAEXXZ) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::create(bool)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::listen(int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: unsigned int __thiscall log4cxx::helpers::SocketImpl::read(void *,unsigned int)const " ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: unsigned int __thiscall log4cxx::helpers::SocketImpl::write(void const *,unsigned int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::bind(class log4cxx::helpers::InetAddress,int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::bind(class log4cxx::helpers::InetAddress,int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::bind(class log4cxx::helpers::InetAddress,int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(inetaddress.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(socketimpl.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::SocketImpl::connect(class log4cxx::helpers::InetAddress,int)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) log4cxxs.lib(datagramsocket.obj) : error LNK2001: unresolved external symbol [EMAIL PROTECTED] log4cxxs.lib(datagramsocket.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::DatagramSocket::receive(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::DatagramPacket> &)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(datagramsocket.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: void __thiscall log4cxx::helpers::DatagramSocket::send(class log4cxx::helpers::ObjectPtrT<class log4cxx::helpers::DatagramPacket> &)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@@23@@Z) log4cxxs.lib(inetaddress.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: static class log4cxx::helpers::InetAddress __cdecl log4cxx::helpers::InetAddress::getLocalHost(void)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) log4cxxs.lib(inetaddress.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: static class log4cxx::helpers::InetAddress __cdecl log4cxx::helpers::InetAddress::getByName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@std@@[EMAIL PROTECTED]@2@@std@@@Z) log4cxxs.lib(inetaddress.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall log4cxx::helpers::InetAddress::getHostAddress(void)const " ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@XZ) log4cxxs.lib(inetaddress.obj) : error LNK2019: unresolved external symbol [EMAIL PROTECTED] referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall log4cxx::helpers::InetAddress::getHostName(void)const " ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@XZ) Debug/Test.exe : fatal error LNK1120: 22 unresolved externals -----Original Message----- From: François Mayrand [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 5:54 PM To: Log4CXX User Subject: Re: VC7 and log4cxxs.lib Hi Set C++ -> Language -> "Treat wchar_t as Built-in Type" to No. Make sure you have defined the following preprocessor variables: LOG4CXX_HAS_WCHAR_T, LOG4CXX_STATIC, APR_DECLARE_STATIC and APU_DECLARE_STATIC François On 5/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > Hi All > > > > I have simple question related VC++ 7 and log4cxxs.lib. > > > > If I tried to link "libcxxs.lib" with my VC7 project, the compilation fails. > > > > Any Ideas? > > > > c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29) : > warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was > marked as #pragma deprecated > > e:\software\log4cxx_0.9.7\log4cxx-0.9.7\include\log4cxx\helpers\tchar.h(263) > : warning C4244: 'argument' : conversion from '__w64 int' to > 'std::streamoff', possible loss of data > > e:\software\log4cxx_0.9.7\log4cxx-0.9.7\include\log4cxx\helpers\tchar.h(264) > : warning C4244: 'argument' : conversion from '__w64 int' to 'int', possible > loss of data > > e:\software\log4cxx_0.9.7\log4cxx-0.9.7\include\log4cxx\helpers\tchar.h(269) > : warning C4244: 'argument' : conversion from '__w64 int' to > 'std::streamoff', possible loss of data > > f:\projects\TestVC++\Test\ASRLogger.h(25) : warning C4091: > 'static ' : ignored on left of 'ASRLogger' when no variable is declared > > Generating Code... > > Linking... > > LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' > specification > > LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' > specification > > ASRLogger.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > log4cxx::Level::OFF" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@B) > > ASRLogger.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: static void __cdecl > log4cxx::BasicConfigurator::configure(void)" > ([EMAIL PROTECTED]@log4cxx@@SAXXZ) referenced in function > "public: static void __cdecl ASRLogger::init(void)" ([EMAIL PROTECTED]@@SAXXZ) > > ASRLogger.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: static void __cdecl > log4cxx::PropertyConfigurator::configure(class > std::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> > const &)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@@Z) > referenced in function "public: static void __cdecl ASRLogger::init(void)" > ([EMAIL PROTECTED]@@SAXXZ) > > ASRLogger.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __cdecl > log4cxx::Logger::getLogger(class > std::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> > const &)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@@Z) > referenced in function "public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __cdecl > ASRLogger::getLogger(void)" > ([EMAIL PROTECTED]@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@@XZ) > > testlog.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > log4cxx::Level::FATAL" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@B) > > testlog.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: bool __thiscall > log4cxx::Logger::isFatalEnabled(void)const " > ([EMAIL PROTECTED]@log4cxx@@QBE_NXZ) referenced in function _main > > testlog.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > log4cxx::Level::ERROR" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@B) > > testlog.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: bool __thiscall > log4cxx::Logger::isErrorEnabled(void)const " > ([EMAIL PROTECTED]@log4cxx@@QBE_NXZ) referenced in function _main > > testlog.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > log4cxx::Level::INFO" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@B) > > testlog.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: bool __thiscall > log4cxx::Logger::isInfoEnabled(void)const " > ([EMAIL PROTECTED]@log4cxx@@QBE_NXZ) referenced in function _main > > testlog.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: void __thiscall > log4cxx::Logger::forcedLog(class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > &,class std::basic_string<char,struct std::char_traits<char>,class > std::allocator<char> > const &,char const *,int)" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]) > referenced in function _main > > testlog.obj : error LNK2001: unresolved external symbol > "__declspec(dllimport) public: static class > log4cxx::helpers::ObjectPtrT<class log4cxx::Level> const > log4cxx::Level::DEBUG" > ([EMAIL PROTECTED]@log4cxx@@[EMAIL PROTECTED]@log4cxx@@@[EMAIL PROTECTED]@B) > > testlog.obj : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: bool __thiscall > log4cxx::Logger::isDebugEnabled(void)const " > ([EMAIL PROTECTED]@log4cxx@@QBE_NXZ) referenced in function _main > > Debug/Test.exe : fatal error LNK1120: 13 unresolved externals > > > > Build log was saved at > "file://f:\projects\TestVC++\Test\Debug\BuildLog.htm" > > Test - 14 error(s), 12 warning(s) > > > > > >
