Ошибки при использовании cURLpp в C ++ - PullRequest
0 голосов
/ 10 марта 2020

Когда я использую cURLpp для вызова API, у меня появляются ошибки, кто-нибудь может мне помочь? Я думаю, это связано с тем, что я связал библиотеку TorchScript и библиотеку cURLpp, потому что я могу запустить другой проект с каждой библиотекой отдельно.

CMakeLists.txt файл:

cmake_minimum_required(VERSION 3.15)
project(segment_api_C__)

set(CMAKE_CXX_STANDARD 11)

find_package(Torch REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} ${TORCH_LIBRARIES} )
target_link_libraries(${PROJECT_NAME} -lcurlpp -lcurl -lm)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

Ошибка:

CMakeFiles/segment_api_C__.dir/main.cpp.o: In function `curlpp::internal::OptionContainer<std::list<std::string, std::allocator<std::string> > >::OptionContainer(std::list<std::string, std::allocator<std::string> > const&)':
/usr/include/curlpp/internal/OptionContainer.inl:38: undefined reference to `curlpp::internal::SList::SList(std::list<std::string, std::allocator<std::string> > const&)'
CMakeFiles/segment_api_C__.dir/main.cpp.o: In function `curlpp::internal::OptionContainer<std::list<std::string, std::allocator<std::string> > >::setValue(std::list<std::string, std::allocator<std::string> > const&)':
/usr/include/curlpp/internal/OptionContainer.inl:52: undefined reference to `curlpp::internal::SList::operator=(std::list<std::string, std::allocator<std::string> > const&)'
CMakeFiles/segment_api_C__.dir/main.cpp.o: In function `curlpp::internal::OptionContainer<std::list<std::string, std::allocator<std::string> > >::getValue()':
/usr/include/curlpp/internal/OptionContainer.inl:59: undefined reference to `curlpp::internal::SList::operator std::list<std::string, std::allocator<std::string> >()'
collect2: error: ld returned 1 exit status
CMakeFiles/segment_api_C__.dir/build.make:86: recipe for target 'segment_api_C__' failed
make[3]: *** [segment_api_C__] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/segment_api_C__.dir/all' failed
make[2]: *** [CMakeFiles/segment_api_C__.dir/all] Error 2
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/segment_api_C__.dir/rule' failed
make[1]: *** [CMakeFiles/segment_api_C__.dir/rule] Error 2
Makefile:118: recipe for target 'segment_api_C__' failed
make: *** [segment_api_C__] Error 2

Спасибо за помощь и хорошего дня.

...