user959129
user959129

Reputation:

c++ and mongodb - can't compile - undefined reference to `boost::system::generic_category()

I am trying to use mongodb for the first time in c++. I just installed the latest version on Ubuntu and also installed the lastest v2.0 c++ driver code. It compiled just fine using scons. In the c++ file the below is my include.

#include <client/dbclient.h>

So..I am assuming I have to make a ref to a boost library but I don't know how to do it.

make all 
Building target: rtb
Invoking: GCC C++ Linker
g++ -L/usr/local/include/ -L/home/boost -L/home/cpp/mongo-cxx-driver-v2.0/mongo -lfcgi++ -o"rtb"  ./src/rtb.o   
./src/rtb.o: In function `__static_initialization_and_destruction_0':
/home/boost/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/home/boost/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/home/boost/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [rtb] Error 1

Upvotes: 3

Views: 3147

Answers (1)

John Zwinck
John Zwinck

Reputation: 249462

Add -lboost_system to your link line.

Upvotes: 4

Related Questions