无法在C ++中使用Boost和Eureqa编译程序

时间:2015-05-21 20:07:47

标签: c++ serialization boost

所以我即将在Xcode中尝试一个简单的Eureqa API示例,如下所示: https://code.google.com/p/eureqa-api/

然而,当我尝试编译它时,此行中的boost标头的access.hpp似乎出现错误: ...

{
    // note: if you get a compile time error here with a
    // message something like:
    // cannot convert parameter 1 from <file type 1> to <file type 2 &>
    // a likely possible cause is that the class T contains a 
    // serialize function - but that serialize function isn't 
    // a template and corresponds to a file type different than
    // the class Archive.  To resolve this, don't include an
    // archive type other than that for which the serialization
    // function is defined!!!
    t.serialize(ar, file_version);
}

... 带有消息:'std :: _ 1 :: pair'

中没有名为'serialize'的成员

为了解决这个问题,我该怎么做?

1 个答案:

答案 0 :(得分:0)

看起来你只想要包含标题

#include <boost/serialization/utility.hpp>

定义std::pair<>的序列化。

编辑评论(到家后)我用linux 1.58在linux上重现了这个问题。确实,编辑eureqa/implementation/connection_impl.h以包含

#include <boost/serialization/utility.hpp>
#include <boost/serialization/nvp.hpp>

修复它:

g++ basic_client.cpp \
    -I/home/sehe/custom/boost/ \
    -I../../ \
    -c -o basic_client.o
g++ basic_client.o \
    /home/sehe/custom/boost/stage/lib/libboost_system.a \
    /home/sehe/custom/boost/stage/lib/libboost_serialization.a \
    /home/sehe/custom/boost/stage/lib/libboost_date_time.a \
    /home/sehe/custom/boost/stage/lib/libboost_thread.a \
    -lpthread  \
    -o basic_client

::_1可能是使用内联命名空间进行版本控制的库实现(libc ++)的工件。