zoukankan      html  css  js  c++  java
  • libCurl的C++引用

    I believe I have gotten LibCurl to work with Visual Studio 2013 now. Persistence ftw! Although, after spending hours trying to solve these error messages, I am a little hesitant at saying everything is working fine now. That is why I am putting a bounty on this question to get clear and conciseinstructions on getting LibCurl to work with Visual Studio 2013.

    This is what I did to get it to work:

    1. First, download the Win32 MSVC package here: http://curl.haxx.se/download.html#Win32 For these instructions sake, let's say you downloaded to C:LibCurl

    2. Start a new project in Visual Studio. Go to Project|Project Properties|VC++ Directories|Include Directories| Add the path to the include directory inside the downloaded package. (C:LibCurlinclude)

    3. Next, go to Project|Project Properties|Linker|General|Additional Library Directories| Add the path to the lib directory. (Where curllib.dll is located)

    4. Then, go to Project|Project Properties|Linker|Input|Additional Dependencies| And add curllib.lib

    5. Now if you compile a test program, you will likely get the message saying libsasl.dll is missing. You will need to download this file and put it in the same directory as your build. I used 7-Zip to extract libsasl.dll from OpenLDAP for WindowsOpenLDAP for Windows

    This is the result of my test code from above: 

    ------------配置好后,将dl放置到对应的目录下--------------------

    示范代码

    #include <iostream>
    #include <stdio.h> 
    #include <curl/curl.h> 
    
    
    int main(void)
    {
        CURL *curl;
        CURLcode res;
    
        curl = curl_easy_init();
        if (curl) {
            curl_easy_setopt(curl, CURLOPT_URL, "http://www.baidu.com");
            res = curl_easy_perform(curl);
    
            /* always cleanup */
            curl_easy_cleanup(curl);
        }
        return 0;
    }
  • 相关阅读:
    c++中利用宏定义简化for循环使用
    UVA1152- 枚举 /二分查找
    acm 模板
    Xwindow的文章
    编程语言博客
    csh与bash比较
    关于锁与并发的资料总结
    linux su和sudo命令的区别
    对Memcached使用的总结和使用场景
    iptables配置——NAT地址转换
  • 原文地址:https://www.cnblogs.com/micro-chen/p/5961195.html
Copyright © 2011-2022 走看看