Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ronieh

macrumors newbie
Original poster
Jul 3, 2014
2
0
Hi,

I have installed boost on my OS X 10.9.4, and can successfully build executables using some boost libraries, for example <boost/date_time/gregorian/gregorian.hpp>

However, when I try and build including boost/thread.hpp, I get the following link error. My BoostLearner.cpp does nothing more than #include <boost/thread.hpp>

I have checked various forums, but could not see an answer which has solved the issue.

If anybody can help it would be much appreciated. I have it working on my old laptop, but would be good to be able to build on my new one also.

Invoking: MacOS X C++ Linker
g++ -L/opt/local/lib/ -o "BoostLearner" ./src/BoostLearner.o -lboost_thread-mt
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init2 in BoostLearner.o
"boost::system::generic_category()", referenced from:
___cxx_global_var_init in BoostLearner.o
___cxx_global_var_init1 in BoostLearner.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [BoostLearner] Error 1

Thank you....
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
Hi,

I have installed boost on my OS X 10.9.4, and can successfully build executables using some boost libraries, for example <boost/date_time/gregorian/gregorian.hpp>

However, when I try and build including boost/thread.hpp, I get the following link error. My BoostLearner.cpp does nothing more than #include <boost/thread.hpp>

I have checked various forums, but could not see an answer which has solved the issue.

If anybody can help it would be much appreciated. I have it working on my old laptop, but would be good to be able to build on my new one also.

Invoking: MacOS X C++ Linker
g++ -L/opt/local/lib/ -o "BoostLearner" ./src/BoostLearner.o -lboost_thread-mt
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init2 in BoostLearner.o
"boost::system::generic_category()", referenced from:
___cxx_global_var_init in BoostLearner.o
___cxx_global_var_init1 in BoostLearner.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [BoostLearner] Error 1

Thank you....

You need to link against Boost System as well. The documentation is quite clear on this. You might also need to link against Boost Chrono if you use some of the time interfaces in Boost Thread.
 

ronieh

macrumors newbie
Original poster
Jul 3, 2014
2
0
builds now

Thanks a lot for the reply. I was making a bit of a mountain out it....

Invoking: MacOS X C++ Linker
g++ -L/opt/local/lib/ -o "BoostLearner" ./src/BoostLearner.o -lboost_thread-mt -lboost_system-mt
Finished building target: BoostLearner
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.