Boost logo

Boost Users :

Subject: Re: [Boost-users] Linking problems with boost serialization and MinGW
From: Florian Burkart (florian.burkart_at_[hidden])
Date: 2012-11-01 06:40:39


I have isolated the issue. Following code, compiled as a shared library,
fails to compile on MinGW (and does on MSVC):

#include <boost/archive/text_oarchive.hpp>

struct Test
{
template<class Archive> void serialize(Archive& ar, const unsigned int) {
ar & a; }
void SerializeToFile(std::ostream& ostream) const
{
boost::archive::text_oarchive myar(ostream);
myar & boost::serialization::make_nvp("test",this);
}
double a;
};

It fails with

mingw32-make[1]: Entering directory
`C:/Flam/Local/Sourcefiles/Cpp/Trunk/build'
cygwin warning:
  MS-DOS style path detected:
C:\Flam\Local\Sourcefiles\Cpp\Trunk\build\Test.txt
  Preferred POSIX equivalent is:
/cygdrive/c/Flam/Local/Sourcefiles/Cpp/Trunk/build/Test.txt
  CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
g++ -shared -fPIC -o RDebug/Test.dll
@"C:\Flam\Local\Sourcefiles\Cpp\Trunk\build\Test.txt" -L.
-L/Sys/boost/MinGW32/boost_1_50_0/lib
 -lboost_serialization-mgw46-mt-d-1_50 -shared
obj/RDebug/Test/Trunk_Test.o: In function
`ZN5boost7archive21basic_text_oprimitiveISoE4saveEd':
/Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:140:
undefined reference to
`boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code,
char const*, char const*)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [RDebug/Test.dll] Error 1
Test.mk:71: recipe for target `RDebug/Test.dll' failed
mingw32-make[1]: Leaving directory
`C:/Flam/Local/Sourcefiles/Cpp/Trunk/build'
mingw32-make.exe: *** [All] Error 2
MultiLiveEnv_wsp.mk:4: recipe for target `All' failed

Any ideas? Can someone link this with MinGW? Thanks!



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net