Take the 2-minute tour ×

I m developing a c program using libcurl.

when I build my program I can use different version of libcurl.

When I change from version to other (of libcurl) I have to change some blocks in my source code to adapt it to the libcurl version.

I'm looking to add macro in my code which will check the libcurl version and then determine which block of source code to use automatically

Are there a macro function or constant in libcurl which return the libcurl version?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

See curl/curlver.h (which is included when you #include <curl/curl.h>).

You have the following numbers to play.



#define LIBCURL_VERSION_NUM 0x071a00
share|improve this answer
I would not recommend using that, I recommend curl_version_info() instead as in my separate answer. –  Daniel Stenberg Jun 3 '12 at 11:36
add comment

Even better is to use curl_version_info() since it will return information about the library actually (dynamically) in use and not the version number that was available when your application was compiled.

libcurl gets updated fairly often and after a couple of months/years it is likely or at least possible that your application might run with a later version than what it was compiled against.

share|improve this answer
add comment

Your Answer


