Menu

#272 Problem with macros_get_logger

beta
closed
5
2013-07-14
2013-03-17
Ken
No

Hi. I just downloaded and installed 1.1.1-rc3. When I link my current project I get the following error:

./main.o: In function `log4cplus::detail::macros_get_logger(log4cplus::Logger&&)':
/home/ken/pool/include/log4cplus/loggingmacros.h:106: undefined reference to `log4cplus::Logger::Logger(log4cplus::Logger&&)'

I am still too new to C++ to fully understand the problem here. Does the above error make sense to you? Does this have to do with your new changes to loggingmacros.h?

Thanks,
Ken

Discussion

  • Václav Haisman

    Václav Haisman - 2013-03-17
    • labels: --> c++11, linker
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,9 +1,11 @@
     Hi. I just downloaded and installed 1.1.1-rc3.  When I link my current project I get the following error:
    
    +~~~~
     ./main.o: In function `log4cplus::detail::macros_get_logger(log4cplus::Logger&&)':
     /home/ken/pool/include/log4cplus/loggingmacros.h:106: undefined reference to `log4cplus::Logger::Logger(log4cplus::Logger&&)'
    +~~~~
    
    -I am still too new to C++ to fully understand the problem here.  Does the above error make sense to you?  Does this have to do with your new changes to loggingmacros.h?
    +I am still too new to C++ to fully understand the problem here.  Does the above error make sense to you?  Does this have to do with your new changes to `loggingmacros.h`?
    
     Thanks,
     Ken
    
    • assigned_to: Václav Zeman
     
  • Václav Haisman

    Václav Haisman - 2013-03-17

    It seems that you have not compiled log4cplus with C++11 support. Both the library and your application have to be compiled in the same "mode". If you want to compile log4cplus in C++11 mode than (if you are using GCC) add CXXFLAGS="-std=c++11" to the configure script command line.

     

    Last edit: Václav Haisman 2013-03-17
  • Ken

    Ken - 2013-03-17

    Hi Vaclav,
    Yes, that was indeed the problem. Although in my case I needed to use CXXFLAGS="-std=c++0x".

    How could you tell this was the problem from the error messages I posted?

    Thanks again!
    Ken

     
  • Václav Haisman

    Václav Haisman - 2013-03-17

    The error message shows macros_get_logger(log4cplus::Logger&&). The && there is rvalue reference which is a C++11 feature.

     
  • Václav Haisman

    Václav Haisman - 2013-03-17
    • status: open --> closed
     
  • Václav Haisman

    Václav Haisman - 2013-07-14

    Ticket moved from /p/log4cplus/support-requests/37/

     

Log in to post a comment.