1. curl 사이트에서 최신 라이브러리 다운로드. http://curl.haxx.se/


2. 적당한 위치에 압축 해제.


3. {압축해제위치}\projects\Windows\{빌드할 VS 버전 선택}\curl.sln 열기


4. 빌드할 라이브러리 선택해서 빌드. (Multi-threaded 옵션은 직접 수정해야함)


5. {압축해제위치}\build\Win32\{빌드한 VS 버전}\LIB [Debug/Release]\libcurl.lib 을 프로젝트로 복사


6. {압축해제위치}\include 를 프로젝트로 복사


7. 프로젝트 설정에서 include 와 lib 설정


8. 만일 라이브러리 타입이 정적라이브러인 경우 Project Property -> C/C++ -> Preprocessor 에 "CURL_STATICLIB"를 반드시 추가. 하지 않으면 링크 에러남
   error LNK2001: unresolved external symbol __imp__curl_easy_init <- 요런에러


9. ldap 관련 에러가 나면 "#pragma comment(lib, "wldap32.lib")" 라이브러리 링크해야함.

1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ber_free referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_memfree referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_value_free_len referenced in function _Curl_ldap 


10. 여기까지 하니까 빌드 및 동작함.


    CURL *curl;
    CURLcode res;
    char buffer[10];
    curl = curl_easy_init();

    if ( 0 != curl )
    {
        curl_easy_setopt(curl, CURLOPT_URL, "http://www.naver.com");
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        if ( res == 0) {
        }
        else {
        }
    } 




+ Recent posts