도움받은 사이트 : https://shaeod.tistory.com/527
1. curl lib zip 파일을 다운로드 받는다.
나는 구글링을 하면서 따라했던지라 최신 버전이 아니라 curl 7.65.1 버전을 다운받았다.
curl lib 다운로드 url : https://curl.se/download/
2. curl lib zip 파일의 압축을 푼다.
경로를 다음으로 이동하면, curl_all.sln 파일이 있다. 더블클릭해서 열어주기
3. 에러 없이 빌드에 잘 성공했다면, 이제 빌드한 lib 파일과 include 폴더를 옮겨줄것임!
1) 아래 경로에 들어가서 두 파일을 복사해서 맨 마지막 굵은 표시한 경로에 복사하기!
- C:\다운로드한 경로\curl-7.65.1\build\Win32\VC14\DLL Release에서 libcurl.lib
- C:\다운로드한 경로\curl-7.65.1\build\Win32\VC14\LIB Debug에서 libcurld.lib
- C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
4. 이제 아래 경로의 include 폴더를 복사해서 굵은 표시의 경로에 붙여넣는다.
- C:\다운로드 경로\curl-7.65.1\include
- C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
5. 끝!!! 마지막으로 curl에서 제공하는 테스트 code로 run 해보기~
#define CURL_STATICLIB
#include <stdio.h>
#include <curl/curl.h>
#pragma comment (lib, "wldap32.lib")
#pragma comment (lib, "ws2_32.lib")
#ifdef _DEBUG
#pragma comment (lib, "libcurld.lib")
#else
#pragma comment (lib, "libcurl.lib")
#endif
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "google.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}