To anyone in the future finding this thread and hoping for an answer... The gcc compiler puts the string class in a different namespace for C++11 to avoid versioning conflicts. I hadn't compiled Thrift with the same version of gcc or as -std=c++11, causing the linking error. Once I got Thrift and my code compiled with the same version of gcc & C++11, the linking worked fine.
-----Original Message----- From: Stavenger, Timothy J Sent: Tuesday, April 19, 2016 1:33 PM To: '[email protected]' <[email protected]> Subject: Linking to THttpClient on RedHat 6.7 We've been using Thrift successfully to make calls from a Java application into a C++ application. We began making callbacks from C++ to Java using THttpClient, but have run into linking errors. I assume this is a problem either with my call to g++ to link or in my Thrift install. Since linking had worked up until the point of using THttpClient, I'm guessing it is a problem with the Thrift install? We're using RedHat 6.7 - I followed the instructions on https://thrift.apache.org/docs/install/centos to get Thrift 0.9.1 installed. I can run Thrift form the command line and the install had worked for linking our server application until we started using the THttpClient class. I've done what I would expect is to be the usual things - ldconfig to reload/rebuild its cache, verify the thrift library is available in /usr/local/lib, verify /usr/local/lib is on LD_LIBRARY_PATH and DYLD_LIBRARY_PATH as well as the proper -Lthrift g++ parameters. The same code and cmake build compiles & links successfully on a Fedora 22 development VM where we were able to install Thrift 0.9.1 via yum. Do any of you have other pointers for what might be going wrong? Here's a snippet of the build error: undefined reference to `apache::thrift::transport::THttpClient::THttpClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' I'm suspicious of the "cxx11" references and wonder if my manual install of Thrift didn't use -std=c++11 or if it should have? Though I would have expected issues like that before now, if that were the case. Thanks! Tim
