logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier" <xavierle...@yahoo.com.ar>
Subject Re[2]: Linking problem
Date Mon, 12 Sep 2005 16:41:59 GMT
On 08/09/2005 at 7:53 Andreas Fester wrote:

>
>This looks like the log4cxx.lib link library is not linked with your
>project. Are you sure that you added it to the libraries of your project?
>Otherwise, please post a minimal source code example, like
>


Hi 

Thanks for your reply.

I'm trying to compile the following code:

-------------
// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>

using namespace log4cxx;
using namespace log4cxx::helpers;

// Define a static logger variable so that it references the
// Logger instance named "MyApp".
LoggerPtr logger(Logger::getLogger("MyApp"));

int main(int argc, char **argv)
{
       int result = EXIT_SUCCESS;
        try
        {
                if (argc > 1)
                {
                        // BasicConfigurator replaced with
PropertyConfigurator.
                        PropertyConfigurator::configure(argv[1]);
                }
                else
                {
                        BasicConfigurator::configure();
                }

                LOG4CXX_INFO(logger, "Entering application.");
                LOG4CXX_INFO(logger, "Exiting application.");
        }
        catch(Exception&)
        {
                result = EXIT_FAILURE;
        }

        return result;
}

----------------

I've copied log4cxx "include" folder to my project folder and passed this
path as parameter to compiler with /I. Then I copied log4cxx.lib to my
project folder and added to linker options.

Nevertheless I get the message:

Linking...
MyPrueba.obj : error LNK2001: 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)"
(__imp_?forcedLog@Logger@log4cxx@@QAEXABV?$ObjectPtrT@VLevel@log4cxx@@@helpe
rs@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)

MyPrueba.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/plog.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

plog.exe - 3 error(s), 0 warning(s)



Thanks in advance for any clue to solve this.


J

PD: I'm using VC++ 6 in WinXP.




Mime
View raw message