logging-log4cxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kadarkarai, Prabhakar \(Prabhakar\)" <prabhak...@avaya.com>
Subject Log C++ Linker problem.
Date Tue, 04 Jan 2005 18:34:31 GMT
Hello All,

 

I am trying to write a small VC++ application for Log C++.

But I am getting a linker error LNK2001 when I am trying to call a
logger function.

I am linking the right Library file (log4cxx.lib) in the Project-->
Settings --> Link Tab. The link file is there in the same directory
where my source CPP file is.

Could you please tell me why am I getting this and how do I resolve this
problem.

 

Thanks,

Prabhakar

 

Here is the sample code

#include "stdlib.h"

#include "log4cxx/logger.h"

#include "log4cxx/basicconfigurator.h"

#include "log4cxx/helpers/exception.h"

#include "log4cxx/ndc.h"

 

using namespace log4cxx;

using namespace log4cxx::helpers;

 

int main()

{

    int result = EXIT_SUCCESS;

    try

    {

                        BasicConfigurator::configure();

                        LoggerPtr rootLogger = Logger::getRootLogger();

 

                        NDC::push(_T("Test context"));

 

                        //rootLogger->debug(_T("debug message"));

                        //rootLogger->info(_T("info message"));

                        //rootLogger->warn(_T("warn message"));

                        //rootLogger->error(_T("error message"));

                        //rootLogger->fatal(_T("fatal message"));

            }

            catch(Exception&)

            {

                        result = EXIT_FAILURE;

            }

 

    return result;

} 

 

 

The Error Message Is

TestLogCPP.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: static void __cdecl
log4cxx::NDC::push(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(__imp_?push@NDC@log4c

xx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@
Z)

Release/TestLogCPP.exe : fatal error LNK1120: 1 unresolved externals

Error executing link.exe.


Mime
View raw message