cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Compiling libcurl with C++ in code blocks

From: Damian Lezama <Damian.Lezama_at_riverbed.com>
Date: Fri, 21 Mar 2014 17:30:23 +0000

You don’t extract files “to your IDE program”, you extract them somewhere in your file system. You have to tell your IDE where to search for include files are, I haven’t used code blocks for a while, so I don’t remember where exactly that option is. Somewhere in your project properties I imagine. When you put the path to curl there, the IDE will pass to the compiler that path with the -I compiler option.

For libraries, those are for the linker, you need to do two things, tell the linker you use libcurl, and depending on where is it located, you may need to add the location as well in a different option. Now, a word of caution, if what you extracted is the source code of curl, you have to build that first. Your question is not curl related, you seem to need to learn some basics of how code is built, so this DL may not be the best place to ask your questions. In order to get help, also note that you need to provide details of your system, for example what operating system you use.

Good luck!

From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of chamburger1_at_aol.com
Sent: Friday, March 21, 2014 6:38 AM
To: curl-library_at_cool.haxx.se
Subject: Re: Compiling libcurl with C++ in code blocks

I'm trying to use the libcurl library in my codeblocks IDE.

I didn't do any make files or anything, I just extracted the 7.35 files to my ide program fiel and then linked the include and lib files. I searched online to get a test prigram to see if I was successful and found this site https://www.hackthissite.org/articles/read/1078

i used teh first bit of code:
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>

int main()
{
curl_global_init( CURL_GLOBAL_ALL );
CURL * myHandle;
CURLcode result; // We’ll store the result of CURL’s webpage retrieval, for simple error checking.
myHandle = curl_easy_init ( ) ;
// Notice the lack of major error checking, for brevity
curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.example.com");
result = curl_easy_perform( myHandle );
curl_easy_cleanup( myHandle );
printf("LibCurl rules!\n");
return 0;
}
:
and it works.

Then I tried teh next one on that site with these headers added #include <curl/types.h>
#include <curl/easy.h>

But it didn't work.

I downloaded the curlpp wrapper but from there I am lost.

-----Original Message-----
From: Damian Lezama <Damian.Lezama_at_riverbed.com<mailto:Damian.Lezama_at_riverbed.com>>
To: libcurl development <curl-library_at_cool.haxx.se<mailto:curl-library_at_cool.haxx.se>>
Sent: Thu, Mar 20, 2014 7:04 pm
Subject: RE: Compiling libcurl with C++ in code blocks

Are you trying to compile curl with codeblocks? Just build curl the way it's

supposed to be built (configure, make). Then put it somewhere, and tell your IDE

about the header location for the compiler and the library location for the

linker.



> -----Original Message-----

> From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se<mailto:curl-library-bounces_at_cool.haxx.se?>] On Behalf Of

> Dan Fandrich

> Sent: Thursday, March 20, 2014 3:50 PM

> To: curl-library_at_cool.haxx.se<mailto:curl-library_at_cool.haxx.se>

> Subject: Re: Compiling libcurl with C++ in code blocks

>

> On Thu, Mar 20, 2014 at 11:14:34AM -0400, chamburger1_at_aol.com<mailto:chamburger1_at_aol.com> wrote:

> > Hello I am trying to use libcurl with c++ in code blocks and I am not

> > able to correctly link it to my projects. Is there a tutorial I can

> > view to get a better idea of how to make the libcurl library work?

> >

> > I¢ve downloaded the m,ost recent curl zip file. Extracted it to my

> > codeblocks program file. I linked the include and lib files. I have

> > compiled an example program I found online but that I wentto use a

> > program with the headers, type.h and easy.h but it would not compile.

> > I downloaded the curlpp c++ wrapper thinking it was an issue with that and

> its still not running.

> >

> > How exactly can I get the new 7.35 to work on c++ in codeblocks. Thank

> you.

>

> libcurl is written in C, not C++, so it will be difficult if not impossible to

compile

> it with a C++ compiler unaltered. You can use the curlpp wrapper, but you'll

> still need to compile libcurl with a C compiler somehow. I'm not familiar with

> what code blocks is, so I can't comment more specifically.

>

> >>> Dan

> -------------------------------------------------------------------

> List admin: http://cool.haxx.se/list/listinfo/curl-library

> Etiquette: http://curl.haxx.se/mail/etiquette.html



-------------------------------------------------------------------

List admin: http://cool.haxx.se/list/listinfo/curl-library

Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-21