Reputation: 31
I am using a Visual Studio GDB project and I have a problem including the the boost linux libraries in the linker inputs.
This are the error received:
undefined reference to `std::__cxx11::basic_string, std::allocator >::_M_create(unsigned long&, unsigned long)'
It seems that the library is not recognized as being compiled with -std=c++11
The commands used to compile the library are:
sudo ./boostrap.sh
sudo ./b2 toolset=gcc cxxflags="-std=c++11"
make
sudo make install
The compilation worked well.
I am using the boost 1.62.0 version and the gcc-5.4.0 version to compile the library. The library included in visual studio project as linker input is libboost_system.a
I think the error from visual studio is related to c++11 compilation.
Could you please tell me if the compilation procedure is ok?
If not, please tell which is the right procedure to compile the library for c++11?
Does the error mean something else?
Upvotes: 3
Views: 6585
Reputation: 393084
Your steps to compile Boost with c++11 enabled are correct (although you don't need all the sudo
). The problem then must be how you compile your own program: it should use exactly matching flags. Check that your program isn't e.g. using the compiler default, which could well be c++14 or c++03.
Upvotes: 4