我正在使用 MingW 在 Windows 上制作一个使用 RestClient-Cpp 的应用程序。我构建了 OpenSSL,之后我尝试动态构建 Curl,但失败了,所以我现在静态构建了它。之后,我尝试构建 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:\MinGW\stuff\restclient/source/restclient.cpp:45: undefined reference to `_imp__curl_easy_init'
c:\MinGW\stuff\restclient/source/restclient.cpp:49: undefined reference to `_imp__curl_easy_setopt'
c:\MinGW\stuff\restclient/source/restclient.cpp:66: undefined reference to `_imp__curl_easy_perform'
c:\MinGW\stuff\restclient/source/restclient.cpp:74: undefined reference to `_imp__curl_easy_getinfo'
c:\MinGW\stuff\restclient/source/restclient.cpp:77: undefined reference to `_imp__curl_easy_cleanup'
c:\MinGW\stuff\restclient/source/restclient.cpp:78: undefined reference to `_imp__curl_global_cleanup'
c:\MinGW\stuff\restclient/source/restclient.cpp:50: undefined reference to `_imp__curl_easy_setopt'
当我链接时......欢迎任何和所有想法......