You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Alexander Rojas <al...@gmail.com> on 2008/09/17 12:35:22 UTC

Initialization problem

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


Re: Initialization problem

Posted by Curt Arnold <ca...@apache.org>.
On Sep 17, 2008, at 5:35 AM, Alexander Rojas wrote:
> 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
>


log4cxx 0.9.7 is obsolete and no longer supported.  log4cxx 0.10.0 is  
the current release.