user3493179 user3493179 - 1 year ago 206
C Question

Ubuntu - #include <curl/curl.h> no such file or directory

I'm developping a C-program using Curl on Ubuntu. I'm using Eclipse Kepler.
I have installed the curl library using

apt-get install libcurl4-gnutls-dev

And I checked if everything is allright usign

ls -l /usr/include/curl

I got

total 172

-rw-r--r-- 1 root root 7065 janv. 31 16:49 curlbuild.h

-rw-r--r-- 1 root root 81593 janv. 31 16:49 curl.h

-rw-r--r-- 1 root root 8901 janv. 31 16:49 curlrules.h

-rw-r--r-- 1 root root 2741 janv. 31 16:49 curlver.h

-rw-r--r-- 1 root root 3472 janv. 31 16:49 easy.h

-rw-r--r-- 1 root root 2790 janv. 31 16:49 mprintf.h

-rw-r--r-- 1 root root 12981 janv. 31 16:49 multi.h

-rw-r--r-- 1 root root 1330 janv. 31 16:49 stdcheaders.h

-rw-r--r-- 1 root root 36048 janv. 31 16:49 typecheck-gcc.h

Although my curl.h file is there, Eclipse wrote this message when I tried to build my program :

fatal error: curl/curl.h: No such file or directory
compilation terminated.

What did I forget to set ? Everything looks good ! :'(
Thanks !

Answer Source

C compilers' (preprocessors', actually) standard include file searching paths should include /usr/include, therefore if the include file curl.h is located in /usr/include/curl/ and is included by #include <curl/curl.h>, C compilers, such as gcc, should be able to find it without any problem.

However, you are using a toolchain under /opt/toolchains/arm-2011.V2/bin, I guess it is a cross-compiling toolchain. In this case, you cannot use the curl library, because which is for the host system, which probably is a x86 or x86_64 system.

To use curl library in your ARM project, you need to install the curl library development package for ARM, if that is possible. If the software repositories do not have those packages, then you need to download the source code and cross-compile it for ARM first.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download