I have successfully installed and run mongodb on my macbook pro with
the c++ driver, but when I am trying to do the same on a computer in
school (need to do lengthy simulations) I encounter some errors. The
database itself works nicely, but when I try to compile my program I
get a lot of these errors:
/chalmers/users/X/thesis/libs/mongo-cxx-driver-nightly//
libmongoclient.a(spin_lock.o): In function
`__static_initialization_and_destruction_0(int, int)':
spin_lock.cpp:(.text+0x44): undefined reference to
`boost::system::get_system_category()' spin_lock.cpp:(.text+0x50):
undefined reference to `boost::system::get_generic_category()'...
I have downloaded, built and tried boost versions 1.4.8, 1.4.7 and
1.44.0. As I understand get_system_category() and
get_generic_category() are both deprecated and replaced by the same
method name with the “get” dropped. However, on my macbook I use boost
1.4.7 and it works..
I have tried both nightly and latest 2.0 version of the c++ driver. I
still get the same error. The computer in school is a RedHat
Enterprice Linux Server. It doesn’t have libboost_system in the /usr/lib folder. Since I don’t have root access I have
downloaded and built the libraries needed (boost, libcurl) and I am
pointing to those in by makefile:
path = ./build/
Ipath = -I/../mongo-cxx-driver-v2.0/mongo/ - I/.../boost_1_44_0/
Lpath = -L/.../mongo-cxx-driver-nightly/ -L/.../boost_1_44_0/stage/lib -L/.../curl/lib
libs = -lboost_system -lmongoclient -lboost_thread -lboost_filesystem -lboost_program_options -lcurl
db: sdc.o main.cpp
g++ main.cpp $(path)sdc.o $(Ipath) $(Lpath) $(libs) -o $ (path)db
sdc.o: ../controller.h ../controller.cpp
g++ -c ../controller.cpp -o ./build/sdc.o $(Ipath)
Has anyone else had this problem? Does anyone see what I am doing
wrong here?
Thanks
It worked with boost version 1.42..