Help with Visual Studio settings for Boost Serialization

I am trying to implement very simple sample of boost serialization.
I have a sample class, class1. It only contains a simple int variable.
I followed the examples given here :
http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html
http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html
I also think that i followed this guideline :
http://beta.boost.org/doc/libs/1_44_0/more/getting_started/windows.html
but i am not sure...
Here is the error i get:
error LNK2019: unresolved external symbol "private: void __thiscall
class1::serialize

I am assuming you have built the boost source and generated the serialization .dll and .lib files. You need to specify the directory of the serialization library .lib files in the Visual Studio environment as the "Library Files Directory" to link your application against them. It is somewhere in the project settings->Linker page. On Dec 4, 2010, at 4:17 PM, Abdullah ARSLAN wrote:
I am trying to implement very simple sample of boost serialization. I have a sample class, class1. It only contains a simple int variable. I followed the examples given here : http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html
I also think that i followed this guideline : http://beta.boost.org/doc/libs/1_44_0/more/getting_started/windows.html but i am not sure...
Here is the error i get:
error LNK2019: unresolved external symbol "private: void __thiscall class1::serialize
Could you help me with this error or could you guide me with installation and running a very simple serialization example, step by step... like download this, install this and etc...
I am using visual studio 2008 express...
Thanks in advance..
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Actually i am very newbie trying to learn things.
I tried to to build it with bjam. i waited 2 hours for it to finish but it
did not finish and i closed it.
Then i found libboost_serialization-vc90-mt-gd-1_44.lib file on internet and
place it in boost home\lib directory. I also added it to visual studio
configuration linker-> input -> additional dependencies
i also set the include directory and additional library directory through
the configuration panel...
I still get problem..
is not there a simple way of using boost? (only serialization feature)
do anyone have to build it?
Abdullah Arslan
Software Engineering and Management Master Program, University of Göteborg
On Sat, Dec 4, 2010 at 5:58 PM, Emre Türkay
I am assuming you have built the boost source and generated the serialization .dll and .lib files.
You need to specify the directory of the serialization library .lib files in the Visual Studio environment as the "Library Files Directory" to link your application against them. It is somewhere in the project settings->Linker page.
On Dec 4, 2010, at 4:17 PM, Abdullah ARSLAN wrote:
I am trying to implement very simple sample of boost serialization. I have a sample class, class1. It only contains a simple int variable. I followed the examples given here : http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html I also think that i followed this guideline : http://beta.boost.org/doc/libs/1_44_0/more/getting_started/windows.html but i am not sure...
Here is the error i get:
error LNK2019: unresolved external symbol "private: void __thiscall class1::serialize
Could you help me with this error or could you guide me with installation and running a very simple serialization example, step by step... like download this, install this and etc...
I am using visual studio 2008 express...
Thanks in advance..
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Abdullah ARSLAN wrote:
I am trying to implement very simple sample of boost serialization. I have a sample class, class1. It only contains a simple int variable. I followed the examples given here : http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html
I also think that i followed this guideline : http://beta.boost.org/doc/libs/1_44_0/more/getting_started/windows.html but i am not sure...
Here is the error i get:
error LNK2019: unresolved external symbol "private: void __thiscall class1::serialize
This is likely an error in your application. class1::serialize<...> is not defined in the library or the serialization headers. It's missing from your application. You've used something like class1 c; ... ar << c but there is no classs class1 { ... template<class Archive> void serialization(Archive &ar, unsigned int version){ ... } ... }; Robert Ramey

you seem to be right.
I was using a header file for class declaration and a cpp file for
definition, when i moved everything to cpp file,
It worked.
But what is the problem? My header file contains
template<class Archive>
void serialize(Archive & ar, const unsigned int version);
and in cpp file
template<class Archive>
void g7GameObject::serialize(Archive & ar, const unsigned int version)
{
ar & height;
ar & width;
......
} // my class name is g7GameObject
and with above code i get following error
error LNK2019: unresolved external symbol "private: void __thiscall
g7GameObject::serialize....
What am i doing wrong
Abdullah Arslan
Software Engineering and Management Master Program, University of Göteborg
On Sat, Dec 4, 2010 at 7:13 PM, Robert Ramey
Abdullah ARSLAN wrote:
I am trying to implement very simple sample of boost serialization. I have a sample class, class1. It only contains a simple int variable. I followed the examples given here : http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html
I also think that i followed this guideline : http://beta.boost.org/doc/libs/1_44_0/more/getting_started/windows.html but i am not sure...
Here is the error i get:
error LNK2019: unresolved external symbol "private: void __thiscall class1::serialize
This is likely an error in your application. class1::serialize<...> is not defined in the library or the serialization headers. It's missing from your application. You've used something like
class1 c; ... ar << c
but there is no
classs class1 { ... template<class Archive> void serialization(Archive &ar, unsigned int version){ ... } ... };
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On 12/4/2010 6:49 PM, Abdullah ARSLAN wrote:
you seem to be right. I was using a header file for class declaration and a cpp file for definition, when i moved everything to cpp file, It worked.
But what is the problem? My header file contains template<class Archive> void serialize(Archive & ar, const unsigned int version);
and in cpp file template<class Archive> void g7GameObject::serialize(Archive & ar, const unsigned int version) { ar & height; ar & width; ...... } // my class name is g7GameObject
and with above code i get following error error LNK2019: unresolved external symbol "private: void __thiscall g7GameObject::serialize....
What am i doing wrong
In the typical template inclusion model, both the template declaration and the template definition need to be in a header file so that soure using the template can include that header file and get the full template code. If you put the definition in a source file it is quite likely that code which uses that template never "include"s that source file and therefore the template definition is missing when you link.

You suggest putting everything in header file. But in the documentation
example, all the code is in a demo.cpp file.
Besides, i still get same error if i put function definition to header file.
The only solution currently is to write all the class code in a single cpp
file (without .h file). I am not much familiar with c++. But I think there
must be a way of separating the declaration and definition of the template
function.
Any idea?
Abdullah Arslan
Software Engineering and Management Master Program, University of Göteborg
On Sun, Dec 5, 2010 at 2:49 AM, Edward Diener
On 12/4/2010 6:49 PM, Abdullah ARSLAN wrote:
you seem to be right. I was using a header file for class declaration and a cpp file for definition, when i moved everything to cpp file, It worked.
But what is the problem? My header file contains template<class Archive> void serialize(Archive & ar, const unsigned int version);
and in cpp file template<class Archive> void g7GameObject::serialize(Archive & ar, const unsigned int version) { ar & height; ar & width; ...... } // my class name is g7GameObject
and with above code i get following error error LNK2019: unresolved external symbol "private: void __thiscall g7GameObject::serialize....
What am i doing wrong
In the typical template inclusion model, both the template declaration and the template definition need to be in a header file so that soure using the template can include that header file and get the full template code. If you put the definition in a source file it is quite likely that code which uses that template never "include"s that source file and therefore the template definition is missing when you link.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Abdullah ARSLAN
-
Edward Diener
-
Emre Türkay
-
Robert Ramey