卷曲 - 未定义的参考 - 使用RESTCLIENTCPP

Curl - undefined references - using RestClientCpp

本文关键字:使用 RESTCLIENTCPP 参考 未定义 卷曲      更新时间:2023-10-16

我正在制作一个使用mingw在Windows上使用RESTCLENT-CPP的应用程序。我构建了OpenSSL,然后尝试动态地构建卷发,但这失败了,因此我现在可以静态地构建它。之后,我试图建立RESTCLIENT,这并没有给我任何警告。现在在Clion中,我正在使用此CMAKE文件;

cmake_minimum_required(VERSION 3.2)
project(project)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
# add_definitions(-DCURL_STATICLIB)
# find_library(curl NAMES curl libcurl)
# find_package(curl)
# add_definitions(-lcurl)
# find_library(restclient-cpp NAMES restclient restclient-cpp)
# add_library(curl STATIC IMPORTED)
# set_property(TARGET curl PROPERTY IMPORTED_LOCATION C:/MinGW/lib/libcurl.a)
add_executable(project ${SOURCE_FILES})
target_link_libraries(project restclient-cpp)

评论的行是我试图让它工作的一些东西,但是直到现在,还没有运气...我总是得到这个错误;

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../librestclient-cpp.a(librestclient_cpp_la-restclient.o): In function `ZN10RestClient3getERKSs':
c:MinGWstuffrestclient/source/restclient.cpp:45: undefined reference to `_imp__curl_easy_init'
c:MinGWstuffrestclient/source/restclient.cpp:49: undefined reference to `_imp__curl_easy_setopt'
c:MinGWstuffrestclient/source/restclient.cpp:66: undefined reference to `_imp__curl_easy_perform'
c:MinGWstuffrestclient/source/restclient.cpp:74: undefined reference to `_imp__curl_easy_getinfo'
c:MinGWstuffrestclient/source/restclient.cpp:77: undefined reference to `_imp__curl_easy_cleanup'
c:MinGWstuffrestclient/source/restclient.cpp:78: undefined reference to `_imp__curl_global_cleanup'
c:MinGWstuffrestclient/source/restclient.cpp:50: undefined reference to `_imp__curl_easy_setopt'

当我链接时...任何想法都受到欢迎...

已解决;Cmake从我的git中使用了libcurl.dll,因此首先是一个不同的版本。我还将libcurl.dll文件复制到/mingw/bin和/mingw/include,现在它可以按照

来工作。