vendredi 8 septembre 2017

Thrift generated code undefined reference

I'm trying to write some code to work with Thrift-generated code but all I'm getting is a error on generated code. I'm using Thrift 0.10.0.

Error:

TalkService.cpp.o: In function `std::less<lineserver::Contact>::operator()(lineserver::Contact const&, lineserver::Contact const&) const':
TalkService.cpp:(.text._ZNKSt4lessIN10lineserver7ContactEEclERKS1_S4_[_ZNKSt4lessIN10lineserver7ContactEEclERKS1_S4_]+0x23): undefined reference to `lineserver::Contact::operator<(lineserver::Contact const&) const'
collect2: error: ld returned 1 exit status
CMakeFiles/http://ift.tt/2wOkG3S: recipe for target 'testshit' failed
make[2]: *** [testshit] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/testshit.dir/all' failed
make[1]: *** [CMakeFiles/testshit.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

main.cpp:

#include <iostream>
#include <thrift/transport/THttpClient.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TTransportUtils.h>
#include <boost/algorithm/string.hpp>
#include "../server/TalkService.h"

using namespace std;
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace lineserver;

int main()
{
    boost::shared_ptr<TTransport> socket(new THttpClient("http://ift.tt/2xgdl08", 443, "/api/v3/TalkService.do"));
    boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
    boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
    TalkServiceClient client(protocol);

    return 0;
}

Thrift file used for generating: line.thrift

I'd really love some help with this because I've been trying to figure out the solution for quite some time.

Aucun commentaire:

Enregistrer un commentaire