cURL / Mailing Lists / curl-library / Single Mail


Re: Can't compile my first libcurl app

From: Daniel Stenberg <>
Date: Wed, 16 Jan 2002 16:03:41 +0100 (MET)

On 16 Jan 2002, Matthew Nuzum wrote:

[curl-config magic cut out]

> It works, of course. I realize you're busy with other things, but could
> you tell me what this does? I have never had to write a program that uses
> any command line options for gcc. Most of my work is in Perl or PHP.

curl-config is a tool that gets generated at build-time for exactly this
purpose. It will keep the information about where the various things that
libcurl wants are stored, and how to tell the compiler about them.

Therefore, the output for "curl-config --cflags" might be very different
between various curl installations and what my command outputs on my Solaris
box will hardly look like output your Linux version shows.

Anyway, these two curl-config basics are:

 --cflags shows the compiler flags to use for compiling libcurl using C
           or C++ code, including include path for libcurl and any realated
           libraries that your libcurl may use

 --libs shows the linker flags to use for building your application with
           libcurl and libs that your application will need to work with

You can invoke those commands manually and check the output. If there's
any flags you don't understand, then use the gcc man page.

> I tested your instructions with g++ and they worked just fine as well. Do
> you think there will be any other gotchas that may appear later due to g++?

There shouldn't be any major ones. The most obvious ones to keep in mind is
when you pass callback function pointers to libcurl. You need to remember
that those function pointers need to be pure C functions, not C++ ones. You
need those extern "C" things around them.

I think that's about it!

    Daniel Stenberg -- curl groks URLs --
Received on 2002-01-16