logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Rojas <alexander.ro...@gmail.com>
Subject Initialization problem
Date Wed, 17 Sep 2008 10:35:22 GMT
Hi,
I'm trying to use log4cxx for a project I'm working on. The problem is
when I try to load the logger as described in the tutorial like this:
        LoggerPtr
        GluePairUnitDlg::logger(Logger::getLogger("gluepairunitdlg"));

I get the following errors:

        gluepairunit.cpp:4: error: no matching function for call to
        'log4cxx::Logger::getLogger(const char [16])'
        /usr/include/log4cxx/logger.h:295: note: candidates are: static
        log4cxx::LoggerPtr log4cxx::Logger::getLogger(const
        log4cxx::String&)
        /usr/include/log4cxx/logger.h:316: note: static
        log4cxx::LoggerPtr log4cxx::Logger::getLogger(const
        log4cxx::String&, log4cxx::spi::LoggerFactoryPtr)

Now, If I change the loader for this:

        LoggerPtr
        GluePairUnitDlg::logger(Logger::getLogger(L"gluepairunitdlg"));

I get this error:
        
        gluepairunit.cpp:4: undefined reference to
        `log4cxx::Logger::getLogger(std::basic_string<wchar_t,
        std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'

I try to use the Constructor of a string like this

        String tmp("gluepairunitdlg");
        LoggerPtr GluePairUnitDlg::logger(Logger::getLogger(tmp));      
        
And then I get this set of errors:

        gluepairunit.cpp:4: error: no matching function for call to
        'std::basic_string<wchar_t, std::char_traits<wchar_t>,
        std::allocator<wchar_t> >::basic_string(const char [16])'
        /usr/include/c++/4.2/bits/basic_string.tcc:233: note: candidates
        are: std::basic_string<_CharT, _Traits,
        _Alloc>::basic_string(typename
        _Alloc::rebind<_CharT>::other::size_type, _CharT, const _Alloc&)
        [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>,
        _Alloc = std::allocator<wchar_t>]
        /usr/include/c++/4.2/bits/basic_string.tcc:226: note:
        std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const
        _CharT*, const _Alloc&) [with _CharT = wchar_t, _Traits =
        std::char_traits<wchar_t>, _Alloc = std::allocator<wchar_t>]
        
And if I try this:
        
        String tmp(L"gluepairunitdlg");
        LoggerPtr GluePairUnitDlg::logger(Logger::getLogger(tmp));

The string is created perfectly but the call to get logger gives me:
        
        gluepairunit.cpp:5: undefined reference to
        `log4cxx::Logger::getLogger(std::basic_string<wchar_t,
        std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
        
I'm working on Ubuntu 8.04 Hardy, log4cxx version 0.9.7-6, gcc 4.2.3.
The IDE is kdevelop and the file is encoded as UTF-8.

I don't know if this is all the relevant information. Thank you for your
help

Alexander Rojas


Mime
View raw message