Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using the following components of boost 1.53.0 in conjunction with C++11 libs . . .

  • boost::signals2::scoped_connection
  • boost::signals2::signal
  • boost::signals2::connection
  • boost::math::constants
  • boost::circular_buffer
  • boost::lexical_cast

According to this answer, I do not need to link against libraries to use these parts of boost. According to this answer, signals2 should be header only also. However, I still receive linker errors . . .

Undefined symbols for architecture i386:
  "boost::system::system_category()", referenced from:
  ___cxx_global_var_init2 in Main.o
  ...
  "boost::system::generic_category()", referenced from:
  ___cxx_global_var_init in Main.o
  ___cxx_global_var_init1 in Main.o
  ...

Why?

share|improve this question
 
A quick browse of the documentation for Signals2 in Boost 1.53.0 also says that it's header only. I'm reasonably sure the others are too. However... are you sure you don't have, say, Boost.Asio in that list too? That requires linking with Boost.System for its error codes. –  Kaz Dragon Jun 7 '13 at 10:08
2  
You just excluded the interesting part: referenced from: ... from where? That part will give you the info wich lib/function calls Boost.System –  Arne Mertz Jun 7 '13 at 10:12
 
@ArneMertz added some detail . . the rest is a list of other files giving the same ___cxx_global_var_init type messages –  learnvst Jun 7 '13 at 10:57
 
please give us the full compiler error, and also your full list of Boost packages. E.g. Boost.Asio also uses Boost.system if I am not mistaken –  TemplateRex Jun 7 '13 at 10:58
 
Problem solved . . see Answer. Darn I feel stupid :S Thanks all –  learnvst Jun 7 '13 at 11:10
add comment

2 Answers

Boost.Signals2 is indeed header-only, but Boost.System is not. You have to make sure that you don't have any dependency on that library. If it's in your own code, you have to build Boost.System and link against it. If it's called from any header-only Boost library, file a bug report.

share|improve this answer
add comment

The problem was a spurious

#include <boost/thread/mutex.hpp>

accidentally left in the middle of a file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.