I'm trying to use some curl code to test the lib but I can't compile it :(
I'm using Clion (Cmake + gcc) and I've got a libcurl.a, a libcurl.dll and a libcurl.dlla What am I suppose to do with those 3 files ?
This is my CmakeLists.txt :
cmake_minimum_required(VERSION 3.10)
project(curl_test2 C)
set(CMAKE_C_STANDARD 99)
ADD_DEFINITIONS( -DCURL_STATICLIB )
include_directories( "include" )
set(SRCS"
srcs/main.c")
set(HEADERS
"include/curl/curl.h"
"include/curl/easy.h")
link_directories("lib")
add_executable(curl_test2 ${SRCS} ${HEADERS})
target_link_libraries(curl_test2 "curl")
this is my project:
include
--curl
--curl.h
srcs
--main.c
lib
--libcurl.a
(--dlls
--libcurl.dll
--libcurl.dlla) <- i'm not using them for now
this is my main.c (just a libcurl example, not really important - i'm just trying to compile):
#include <stdio.h>
#include "curl/curl.h"
int main(void)
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
When I'm trying to build the compiler drop this error : "undefined reference to `_imp__curl_global_init'" (and all other curl function calls)
Can you help me ? I'm a bit lost - I did not really use Cmake before..
Thank you !