thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raghava Mutharaju <>
Subject Re: linker error after change in thrift file
Date Mon, 26 Jul 2010 17:57:07 GMT

Since this error is related to "operator <", I have removed other code from
the files. Only the relevant code is present in the below 2 links.

employee_types.h --
employee_types.cpp --

Also, I tried the following things:

   1. Instead of using set<SavingsInfo>, I tried SavingsInfo and it worked.
   Savings is a field in EmployeeInfo
   2. I commented out "operator <" because I thought it is not being used
   anywhere, but I got the following build error.

Building file: ../src/employee_types.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/thrift
-I/Users/raghava/Software/Boost_C++_Library/boost_1_43_0 -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"src/employee_types.d"
-MT"src/employee_types.d" -o"src/employee_types.o"
/usr/include/c++/4.2.1/bits/stl_function.h: In member function 'bool
std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp =
/usr/include/c++/4.2.1/bits/stl_tree.h:982:   instantiated from
'std::pair<typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::iterator, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::_M_insert_unique(const _Val&) [with _Key =
com::xxxx::thrift::employee::SavingsInfo, _Val =
com::xxxx::thrift::employee::SavingsInfo, _KeyOfValue =
std::_Identity<com::xxxx::thrift::employee::SavingsInfo>, _Compare =
std::less<com::xxxx::thrift::employee::SavingsInfo>, _Alloc =
/usr/include/c++/4.2.1/bits/stl_set.h:307:   instantiated from
'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>,
_Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool>
std::set<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key =
com::xxxx::thrift::employee::SavingsInfo, _Compare =
std::less<com::xxxx::thrift::employee::SavingsInfo>, _Alloc =
../src/employee_types.cpp:163:   instantiated from here
/usr/include/c++/4.2.1/bits/stl_function.h:227: error: no match for
'operator<' in '__x < __y'
make: *** [src/employee_types.o] Error 1

Why is "operator <" overloaded? What could be the reason for the linker
error (mentioned earlier)?

Thank you.


On Sun, Jul 25, 2010 at 3:56 PM, Raghava Mutharaju <> wrote:

> Hi,
> The source files in which SavingsInfo is used are given below
> employee_types.h --
> employee_types.cpp --
> Regards,
> Raghava.
> On Sun, Jul 25, 2010 at 3:58 AM, Raghava Mutharaju <
>> wrote:
>> Hi all,
>> This might not be entirely a thrift related question but it happened when
>> I made a change in the thrift file. Before making the change, everything was
>> working fine. I made a change to the thrift file and regenerated cpp & java
>> classes. After this change, I started getting linker errors in cpp. Here is
>> the error
>> Undefined symbols:
>> "com::XXXX::thrift::employee::SavingsInfo::operator<(com::XXXX::thrift::employee::SavingsInfo
>> const&) const", referenced from:
>> std::less<com::XXXX::thrift::employee::SavingsInfo>::operator()(com::XXXX::thrift::employee::SavingsInfo
>> const&, com::XXXX::thrift::employee::SavingsInfo const&) constin
>> employee_types.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>> make: *** [ThriftCPPSamples] Error 1
>> I added SavingsInfo type to thrift file, this is the change. I give all
>> the options mentioned in the doc to g++. I gave -I/usr/local/include/thrift,
>> -I/path-to-boost, -L/path-to-boost-lib, -lthrift. But after the change I
>> started getting the above linker error. I couldn't understand the reason for
>> this. The error points to something that was generated by thrift. What could
>> be the reason for the error?
>> Thank you.
>> Regards,
>> Raghava.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message