0

Update: Placing #include "stdafx.h" on the top fixed all errors except:

Error   1   error LNK1104: cannot open file 'libcurl.lib'   C:\Users\Geeh\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\LINK    ConsoleApplication2

A question that's been asked many times, and I still have a hard time installing any kind of library on any kind of compiler. I went for Visual Express, trying to install libcurl, both manually and by using "nuget", which seems like the best option to me. I downloaded and installed NuGet, ran the command to install libcurl, and it did. I included D:\Program Files (x86)\Microsoft Visual Studio 12.0\libcurl\include;$(IncludePath) in "project properties-> VC++Directories/Include directories"

D:\Program Files (x86)\Microsoft Visual Studio 12.0\libcurl\lib;%(AdditionalLibraryDirectories)

in Linker/Additional library directories and

libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;ws2_32.lib;

in Linker/Input/Additional Dependencies. The code is an example as follows:

#include <iostream>
#include <stdio.h> 
#include <curl/curl.h> 
#include "stdafx.h"

int main(void)
{
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if (curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
        res = curl_easy_perform(curl);

        /* always cleanup */
        curl_easy_cleanup(curl);
    }
    return 0;
}

And I'm having those errors:

Warning 1   warning C4627: '#include <iostream>': skipped when looking for precompiled header use   c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 1   1   ConsoleApplication2
Warning 2   warning C4627: '#include <curl.h>': skipped when looking for precompiled header use c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 3   1   ConsoleApplication2
Error   3   error C2065: 'CURL' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 8   1   ConsoleApplication2
Error   4   error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 8   1   ConsoleApplication2
Error   5   error C2065: 'CURLcode' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 9   1   ConsoleApplication2
Error   6   error C2146: syntax error : missing ';' before identifier 'res' c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 9   1   ConsoleApplication2
Error   7   error C2065: 'res' : undeclared identifier  c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 9   1   ConsoleApplication2
Error   8   error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 11  1   ConsoleApplication2
Error   9   error C3861: 'curl_easy_init': identifier not found c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 11  1   ConsoleApplication2
Error   10  error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 12  1   ConsoleApplication2
Error   11  error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 13  1   ConsoleApplication2
Error   12  error C2065: 'CURLOPT_URL' : undeclared identifier  c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 13  1   ConsoleApplication2
Error   13  error C3861: 'curl_easy_setopt': identifier not found   c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 13  1   ConsoleApplication2
Error   14  error C2065: 'res' : undeclared identifier  c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 14  1   ConsoleApplication2
Error   15  error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 14  1   ConsoleApplication2
Error   16  error C3861: 'curl_easy_perform': identifier not found  c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 14  1   ConsoleApplication2
Error   17  error C2065: 'curl' : undeclared identifier c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 17  1   ConsoleApplication2
Error   18  error C3861: 'curl_easy_cleanup': identifier not found  c:\users\geeh\documents\visual studio 2013\projects\consoleapplication2\consoleapplication2\consoleapplication2.cpp 17  1   ConsoleApplication2

0 Answers0