logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michaël CATANZARITI <mca...@apache.org>
Subject Re: log4cxx0.9.7 can't work in msvc6.0
Date Thu, 17 Jun 2004 17:19:09 GMT
Hello,

I think you should add the macro UNICODE, to the C++/preprocessor tab of your project settings.
It seems that your project looks at ANSI définition of log4cxx exports.

Michaël

Wang Zhaoyue wrote:
> hello
> I download the log4cxx0.9.7 and build the dll in msvc6.0 successfully.
>    But I can't use the dll in my test project.
> 
>     Here is my test cpp:
> 
> #include "stdafx.h"
> 
> #include <windows.h>
> 
> #include <log4cxx/config.h>
> #include <log4cxx/logger.h>
> #include <log4cxx/helpers/serversocket.h>
> #include <log4cxx/helpers/socket.h>
> #include <log4cxx/net/socketnode.h>
> #include <log4cxx/xml/domconfigurator.h>
> #include <log4cxx/propertyconfigurator.h>
> #include <log4cxx/helpers/thread.h>
> #include <log4cxx/logmanager.h>
> #include <log4cxx/level.h>
> #include <log4cxx/helpers/stringhelper.h>
> 
> using namespace log4cxx;
> using namespace log4cxx::helpers;
> 
> int main(int argc, char* argv[])
> {
>     //USES_CONVERSION;
>     String fileName = "log4j.properties";
>     PropertyConfigurator::configure(fileName);
>     LoggerPtr logger = Logger::getLogger(_T("my.log"));
>     for (int i=0; i<10; i++)
>     {
>         logger->info(_T("hello, world"));
>         logger->debug(_T("this is a debug statement"));
>     }
>     return 0;
> }
> 
> and get the following error:
> 
> LogTest.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: void __thiscall 
> log4cxx::Logger::debug(class std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> > const &,char const

> *,int)" (__imp_?
> debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)

> 
> LogTest.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: void __thiscall 
> log4cxx::Logger::info(class std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> > const &,char const

> *,int)" (__imp_?i
> nfo@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)

> 
> LogTest.obj : error LNK2001: 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>,cl
> ass std::allocator<char> > const &)" 
> (__imp_?getLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

> 
> LogTest.obj : error LNK2001: 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 &)" (__
> imp_?configure@PropertyConfigurator@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

> 
> Debug/LogTest.exe : fatal error LNK1120: 4 unresolved externals
> Error executing link.exe.
> 
> I build the dll in unicode release mode.
> I have added path to "Tools, Options, Directories, Libraries" which 
> includeing log4cxx.dll,log4cxx.lib, log4cxx.exp and NTEventLogAppender.dll.
> I also add log4cxx.lib to 
> project->settings->Link->General->Object/Library Modules.
> 
> Is there any other specific settings I did not make?
> 
> Thx a lot!
> 
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
> 

-- 
Michaël CATANZARITI
log4cxx project manager

	log4cxx user mailing list:
	log4cxx-user-subscribe@logging.apache.org

	log4cxx developer mailing list:
	mailto:log4cxx-dev-subscribe@logging.apache.org

Mime
View raw message