mrtazz / restclient-cpp

C++ client for making HTTP/REST requests
http://code.mrtazz.com/restclient-cpp/
MIT License
1.57k stars 377 forks source link

undefined reference to `RestClient::Connection::Connection #87

Closed likeshan168 closed 6 years ago

likeshan168 commented 7 years ago

undefined reference to RestClient::Connection::Connection(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_getinfo@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference to curl_slist_free_all@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_setopt@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_perform@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference tocurl_slist_append@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_cleanup@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference tocurl_global_init@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_init@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_reset@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/librestclient-cpp.so: undefined reference to `curl_global_cleanup@CURL_OPENSSL_3' collect2: error: ld returned 1 exit status src/unit_test/services_test/CMakeFiles/runServicesTest.dir/build.make:136: recipe for target 'src/unit_test/services_test/runServicesTest' failed make[3]: [src/unit_test/services_test/runServicesTest] Error 1 CMakeFiles/Makefile2:767: recipe for target 'src/unit_test/services_test/CMakeFiles/runServicesTest.dir/all' failed make[2]: [src/unit_test/services_test/CMakeFiles/runServicesTest.dir/all] Error 2 CMakeFiles/Makefile2:779: recipe for target 'src/unit_test/services_test/CMakeFiles/runServicesTest.dir/rule' failed make[1]: *** [src/unit_test/services_test/CMakeFiles/runServicesTest.dir/rule] Error 2

likeshan168 commented 7 years ago

I have installed the restclient-cpp and have added the dependency in cmakelist file. my code RestClient::init(); RestClient::Connection* conn = new RestClient::Connection(baseUrl); RestClient::Response r; RestClient::init() can be Identified but the RestClient::Connection cannot

mrtazz commented 7 years ago

How did you install the library? It looks like you're missing libcurl. If you installed it from packagecloud then I'll have to update the package dependencies there.

Are you linking libcurl in your build?

mrtazz commented 6 years ago

closing this for inactivity. Please feel free to reopen the issue if the problem persists.

AlekseiSolonkov commented 5 years ago

Hi! Problem still actual on Ubuntu 18.04 64bit

g++ -Wl,-O1 -o core main.o server.o queue.o logger.o connect.o report.o exoclick.o adnium.o trafficstars.o country.o help.o decision.o security.o eventhandler.o messages.pb.o -L/core/ -lorm_mysql -L/usr/local/opt/openssl/lib -L/usr/local/lib/ -lssl -lcrypto -lboost_system -lboost_filesystem -lboost_serialization -lboost_regex -lboost_iostreams -lprotobuf -lnats -lprometheus-cpp-core -lprometheus-cpp-pull -lprometheus-cpp-push -lcurl -lrestclient-cpp -L/core/clickhouse-cpp/build/clickhouse/ -lclickhouse-cpp-lib -L/core/clickhouse-cpp/build/contrib/cityhash/ -lcityhash-lib -L/core/clickhouse-cpp/build/contrib/lz4/ -llz4-lib -L/core/../../../usr/local/lib/ -lprotobuf-c -L/usr/lib/x86_64-linux-gnu -lQt5Sql -lQt5Core -lpthread /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to curl_slist_free_all@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_setopt@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_cleanup@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference tocurl_slist_append@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_init@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_strerror@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_reset@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference tocurl_global_cleanup@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to curl_easy_getinfo@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference tocurl_easy_perform@CURL_OPENSSL_3' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/librestclient-cpp.so: undefined reference to `curl_global_init@CURL_OPENSSL_3' collect2: error: ld returned 1 exit status