Charlie
Charlie

Reputation: 21

an error "undefined reference to 'log4cplus::Logger::operator=(log4cplus::Logger&&)'"

Now there is a problem when i want to compile a project which needs to ld liblog4cplus.a When i use the compile option -std=c++11 ,then there's an error

Undefined reference to 'log4cplus::Logger::operator=(log4cplus::Logger&&)'

but whole project needs the option -std=c++11
So how can i solve this problem?

PS : Compiled on Ubuntu 12.04 ,which gcc version:4.8.2 and liblog4cplus version:1.1.3

Upvotes: 2

Views: 3192

Answers (2)

Andy
Andy

Reputation: 347

my solution:

log4cplus::Logger g_piano_logger; auto logger = log4cplus::Logger::getInstance(... g_logger = logger;

or rebuild log4cplus

note LOG4CPLUS_HAVE_RVALUE_REFS in log4cplus-1.1.1/include/log4cplus/logger.h

Logger& operator=(const Logger& rhs); #if defined (LOG4CPLUS_HAVE_RVALUE_REFS) Logger (Logger && rhs); Logger & operator = (Logger && rhs); #endif

Upvotes: 0

wilx
wilx

Reputation: 18268

You have to compile both your code and log4cplus library with or without the -std=c++11 flag. Mixed compilations are not supported.

Upvotes: 1

Related Questions