Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8637629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:31:30+00:00 2026-06-12T10:31:30+00:00

I’ve been trying to learn more about CURL recently and finally managed to compile

  • 0

I’ve been trying to learn more about CURL recently and finally managed to compile and install it properly as a static library for my test project. Eventually I’ll move on to learning about posting forms and such.

I’ve successfully managed to connect and print out page content from http://www.google.se.

When connecting to a secure http page https://www.google.se I get an empty string as page content.

I’m using this to get information about the options.

I’ve tried the things from this answer, but it didn’t work or I did it wrong.
I also tried turning off verifypeer and verifyhost (though I really want to practice safe solutions), but it didn’t work either.

What do I need to do to make it work?
Am I doing something wrong?


Here’s the test code

#include <iostream>
#include <string>
#include <curl/curl.h>

using namespace std;

static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp){
    ((string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
}

int main(){
  CURL *curl;
  CURLcode res;
  string readBuffer;

  curl = curl_easy_init();
  if(curl){
    curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.se");
    //curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE);

    //Doesn't seem to work
    curl_easy_setopt(curl, CURLOPT_CAINFO, "path\\cacert.pem");

    //Neither does this
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, FALSE);

    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);

    cout<<readBuffer<<endl;

    system("pause");
  }
  return 0;
}

Update

So I got the error message from curl saying Unsupported protocol, which I’m guessing is what it says when SSL doesn’t work. So I had to recompile it with SSL (which is odd, because I thought I did the first time) but…

I’m almost about to give up. Sigh. For some reason or other, now it gave me the error
NMAKE: fatal error U1077 nasmw when making the SSL, even though I clearly gave it the right %PATH% to nasm. I followed the steps to the letter.

So I tried using the curl binaries of type libcurl, but I don’t know how to link it properly in VC++ because the library files are unfamiliar to me.

I keep getting these linker errors when trying to compile the test project.

1>main.obj : error LNK2019: unresolved external symbol _curl_easy_cleanup referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_strerror referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_perform referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_setopt referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_init referenced in function _main

So frustrated… I wish I understood why it has to be so complicated.
I just want to use the library already!


Update 2

Ok… I managed to compile the curl library with SSL and reporting CURL_VERSION_SSL is enabled

curl_version_info_data * vinfo = curl_version_info(CURLVERSION_NOW);

if(vinfo->features & CURL_VERSION_SSL){
    cout<<"CURL: SSL enabled"<<endl;
}else{
    cout<<"CURL: SSL not enabled"<<endl;
}

//Prints out "CURL: SSL enabled"

but I’m still getting the same error message Unsupported protocol. I don’t know what I’m doing wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:31:31+00:00Added an answer on June 12, 2026 at 10:31 am

    Alright, after I’d compiled the library for the nth time, everything seemed fine until I debugged it and it gave me heap errors, suggesting I made a mistake *twitch twitch* again.

    Before starting a new compiling session I took another look around the curl.haxx and found an MSVC package. It made me gleeful, because I know how to handle those! I chose the static library, because that’s what I wanted.

    Though, not everything went smoothly, I had to add some additional linker dependencies for it to work properly.

    namely

    #pragma comment(lib, "curllib_static.lib")
    #pragma comment(lib, "wldap32.lib")
    #pragma comment(lib, "ws2_32.lib")
    #pragma comment(lib, "winmm.lib")
    #pragma comment(lib, "ssleay32.lib")
    #pragma comment(lib, "openldap.lib")
    #pragma comment(lib, "libeay32.lib")
    

    Put those in and used the certificate bundle from the other package I downloaded so that I could connect to HTTPS.

    curl_easy_setopt(curl, CURLOPT_CAINFO, "_path_\ca-bundle.crt");
    

    I am getting a few warnings though, warnings I’ve never seen before. They don’t mess anything up, but it’s got something to do with the PDB file “vc90”, something I thought VC++ handled by itself.

    Here’s the code connecting to https://www.google.se (pragmas removed and added in linker dependencies under project properties) after finally having a proper CURL library.

    Here’s the MSVC package (SSL Enabled). You can use one of the scripts (perl or VBscript) from this package to make the certificate bundle for you.

    Oh, also, if you’re using a static library like me, you have to add the preprocessor definition CURL_STATICLIB

    #include <iostream>
    #include <string>
    #include <curl/curl.h>
    
    using namespace std;
    
    static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp){
        ((string*)userp)->append((char*)contents, size * nmemb);
        return size * nmemb;
    }
    
    int main(){
      CURL *curl;
      CURLcode res;
      string readBuffer;
    
      curl = curl_easy_init();
      if(curl){
        curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.se");
        curl_easy_setopt(curl, CURLOPT_CAINFO, "C:\\libcurl_static\\ca-bundle.crt");
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    
        cout<<readBuffer<<endl;
    
        system("pause");
      }
      return 0;
    }
    

    Was really my fault, I should’ve checked the description on the download wizard they have. I only downloaded the latest source from the archives (7.27.0) because I thought I had to compile it myself to get what I wanted.

    This whole thing is embarrassing. I learned a lot from it though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.