I have Win7x64 and Visual Studio 2012 Express .
- Download this version of cURL: Win32 - MSVC 7.18.0.
- In the project properties I specified paths to directories with
.lib
and.h
files. - In linker added
libcurl.lib
. - I threw
libcurl.dll
into theDebug
folder with theexe
file. (Otherwise, the program says that it can not find it).
Here is the main.cpp
code (taken from the site with examples):
#include <stdio.h> #include <curl.h> int main(void) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); /* Выполнение запроса, res будет содержать код возврата */ 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); } return 0; }
It seems everything is compiled, but at startup it climbs this:
Error starting application (0xc000007b). To exit the application, click "OK."
How can this be fixed?
UPD: When I compile in x64:
error LNK2019: ссылка на неразрешённый внешний символ __imp_curl_easy_strerror в функции main error LNK2019: ссылка на неразрешённый внешний символ __imp_curl_easy_init в функции main error LNK2019: ссылка на неразрешённый внешний символ __imp_curl_easy_setopt в функции main error LNK2019: ссылка на неразрешённый внешний символ __imp_curl_easy_perform в функции main error LNK2019: ссылка на неразрешённый внешний символ __imp_curl_easy_cleanup в функции main error LNK1120: неразрешённых внешних элементов: 5
curl_easy_perform
returns 0). I suspect that the library is compiled with multithreading support, and your code is not. - KoVadim/MD
/MT
and play with them . - KoVadim