Reputation: 8200
Recently, I try to create an makefile as below:
all:
g++ test.cpp -o Test
It creates an runnable Test
. However, If I try to link it to an library (as LibCurl
to use SSL connetion):
all:
g++ test.cpp -o Test -lcurl
It goes wrong (I already installed libcurl4-openssl-dev
package as standard library)!
What does I miss? Can you give any solution? Thanks!!
Edit: The error is below:
fatal error: curl.h: No such file or directory
Upvotes: 1
Views: 838
Reputation: 776
The header files are missing in the include search path.
You will have install the development package of libcurl. For example, install libcurl-devel-7.19.0-11.1.x86_64.rpm for Open Suse 11.1.
To know the list of files that would be installed by the rpm, download the rpm, type the following command in the downloaded dir.
rpm -qlp <rpmname>
As per the example above, the command would be
rpm -qlp libcurl-devel-7.19.0-11.1.x86_64.rpm
This will list the files along with the path in which it would be installed to. In our example, the result would look like..
/usr/include/curl
/usr/include/curl/curl.h
/usr/include/curl/curlbuild.h
/usr/include/curl/curlrules.h
/usr/include/curl/curlver.h
and so on...
and
Install the development libcurl package for the version of linux you use and include #include <curl/curl.h>
in your code.
Refer http://curl.haxx.se/download.html to download the right one
Upvotes: 1