Re: [Log4cplus-devel] Failed to compile with flag "-std=c++11" in projects
Logging Framework for C++
Brought to you by:
wilx
From: Václav Z. <vha...@gm...> - 2013-10-06 07:18:27
|
What was the configure script command line? You have to compile log4cplus with C++11 support enabled. Add CXXFLAGS="-std=c++11" to its command line. On 06/10/2013, Delian Xu <del...@gm...> wrote: > Hello, > > How to make log4cplus work with compile-flag "-std=c++11" ? > > It seems that log4cplus can work with c++11, but I failed to try it, please > help to have a look, thanks! > > > $ g++ -Wall* -std=c++11* main_trader.cpp liblog4cplus.a -lpthread > > /tmp/ccrHnjIt.o: In function > `log4cplus::detail::macros_get_logger(log4cplus::Logger&&)': > main_trader.cpp:(.text._ZN9log4cplus6detail17macros_get_loggerEONS_6LoggerE[_ZN9log4cplus6detail17macros_get_loggerEONS_6LoggerE]+0x2a): > *undefined reference to `log4cplus::Logger::Logger(log4cplus::Logger&&)*' > collect2: error: ld returned 1 exit status > > > I use macros like "LOG4CPLUS_ERROR(Logger::getRoot(), p)" in my code. > > I'm using Ubuntu13.04, x64. with g++ 4.7 > $ g++ --version > g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 > > > > ---------------------------------------------------------------------------------------------------------------------- > I compiled log4cplus myself, with 'default' option or flags. > > (In log4cplus-1.1.2-rc3:) $ cat ./config.log |grep "c++11" > > configure:5755: checking CXXFLAGS for gcc -Wc++11-compat > configure:5782: g++ -c -g -O2 -Wall -Wextra -pedantic -Wstrict-aliasing > -Wstrict-overflow -Woverloaded-virtual -Wold-style-cast -Wc++0x-compat > -pedantic -Werror -Wc++11-compat -D_GNU_SOURCE=1 conftest.cpp >&5 > configure:5796: result: -Wc++11-compat > -- VZ |