2

So I am about to try a simple Eureqa API example in Xcode as shown on: https://code.google.com/p/eureqa-api/

However as I tried to compile it there seems to be an error in the access.hpp of the boost headers in this line: ...

{
    // 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);
}

... With a message: No member named 'serialize' in 'std::_1::pair'

What should I do in order to fix this?

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • Thanks! I tried that and then this error pops out in the utility.hpp: `ar & boost::serialization::make_nvp("first", const_cast(p.first)); ar & boost::serialization::make_nvp("second", p.second);` saying that: No member named 'make_nvp' in namespace 'boost::serialization' – Jusuf Aurum Merukh May 22 '15 at 00:34
  • Aha. I see you did respond. As you have found you need to comment on the answer you respond to. Alternatively/additionally you can use `@JusufAurumMerukh` style explicit addressing (only if it adds value) – sehe May 22 '15 at 15:55

1 Answers1

0

Looks like you just want to include the header

#include <boost/serialization/utility.hpp>

which defines the serialization for std::pair<>.

EDIT After the comment (and arriving home) I've reproduced the problem on linux with boost 1.58. Indeed, editing eureqa/implementation/connection_impl.h to include

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

fixes it:

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

The ::_1 is likely an artifact of the library implementation (libc++) using inline namespaces for versioning.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • Thanks! I tried that and then this error pops out in the utility.hpp: `ar & boost::serialization::make_nvp("first", const_cast(p.first)); ar & boost::serialization::make_nvp("second", p.second);` saying that: No member named 'make_nvp' in namespace 'boost::serialization' – Jusuf Aurum Merukh May 22 '15 at 15:50
  • @JusufAurumMerukh I reproduced and tested the fix. I'm pretty sure you inserted the include(s) in the wrong place. See updated answer – sehe May 22 '15 at 19:30
  • Ok i see. I used my mac xcode and a lot of this type of error pops-out afterwards: `Undefined symbols for architecture x86_64:` I also don't quite understand the g++ codes you write. – Jusuf Aurum Merukh May 22 '15 at 20:00
  • That's just the makefile commands being displayed. I don't write them. I only did `make` in the `examples/basic_client` directory, like the documentation told me. That would also solve your linker errors, because, well, you failed to link the necessary libraries... – sehe May 22 '15 at 20:02
  • [tag:c++-faq] has this [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix). Only 356 upvotes :) – sehe May 22 '15 at 20:03