Reputation: 5058
I installed Boost via sudo apt-get install libboost-all-dev
on the most recent version of Ubuntu. Now I want to compile a project that uses the Boost.Serialization
library, which needs to be linked.
I've tried many variants of the following, without success:
gcc -I /usr/lib code.cpp -o compiled /usr/lib/libboost_serialization.a
and
gcc -I /usr/lib code.cpp -o compiled -l libboost_serialization
The error message is:
error: ‘split_member’ is not a member of ‘boost::serialization
`
What am I missing?
Upvotes: 0
Views: 2698
Reputation: 121
split member is a problem with compiling where boost is assuming there are split calls for serialize and deserialize.
http://www.ocoudert.com/blog/2011/07/09/a-practical-guide-to-c-serialization/
Upvotes: 0
Reputation:
You are having troubles with compiling your code, not linking. On that stage it has nothing to do with libraries. At that point the fact that you have to link against something is irrelevant.
Make sure you are including boost/serialization/split_member.hpp
directly or indirectly and get your code compiled first.
On a side note, -I
flag is used to specify path to include files and not libraries. For libraries, use -L
. But if you have installed Boost from apt, then it should already be in the path and so no additional -I
or -L
should be required. And when you specify -l
, you have to emit lib
from the beginning of library name and not put a space between a flag and its argument. Assuming working code, something like this should do:
g++ code.cpp -o compiled -lboost_serialization
I'd also recommend you pass -Wall
flag to make compiler be more verbose and warn you about possible mistakes in your code.
Upvotes: 1