C语言 Ubuntu - #include <curl/curl.h> 没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22834233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu - #include <curl/curl.h> no such file or directory
提问by user3493179
I'm developping a C-program using Curl on Ubuntu. I'm using Eclipse Kepler. I have installed the curl library using
我正在 Ubuntu 上使用 Curl 开发 C 程序。我正在使用 Eclipse 开普勒。我已经使用安装了 curl 库
apt-get install libcurl4-gnutls-dev
apt-get install libcurl4-gnutls-dev
And I checked if everything is allright usign
我检查了一切是否正常
ls -l /usr/include/curl
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
共 172 个
-rw-r--r-- 1 根 7065 janv。31 16:49 curlbuild.h
-rw-r--r-- 1 根 81593 janv. 31 16:49 curl.h
-rw-r--r-- 1 根根 8901 janv。31 16:49 curlrules.h
-rw-r--r-- 1 根根 2741 janv。31 16:49 curlver.h
-rw-r--r-- 1 根根 3472 janv。31 16:49 easy.h
-rw-r--r-- 1 根根 2790 janv。31 16:49 mprintf.h
-rw-r--r-- 1 根根 12981 janv。31 16:49 多小时
-rw-r--r-- 1 根 1330 janv。31 16:49 stdcheaders.h
-rw-r--r-- 1 根根 36048 janv。31 16:49 类型检查-gcc.h
Although my curl.h file is there, Eclipse wrote this message when I tried to build my program :
虽然我的 curl.h 文件在那里,但当我尝试构建我的程序时 Eclipse 写了这条消息:
fatal error: curl/curl.h: No such file or directory compilation terminated.
致命错误:curl/curl.h:没有这样的文件或目录编译终止。
What did I forget to set ? Everything looks good ! :'( Thanks !
我忘了设置什么?一切看起来都不错!:'( 谢谢 !
采纳答案by Lee Duhem
C compilers' (preprocessors', actually) standard include file searching paths should include /usr/include, therefore if the include file curl.his 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.
C 编译器(实际上是预处理器)的标准包含文件搜索路径应该包含/usr/include,因此如果包含文件curl.h位于 中/usr/include/curl/并且被包含在 中#include <curl/curl.h>,C 编译器(例如gcc)应该能够毫无问题地找到它。
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.
但是,您使用的是 下的工具链/opt/toolchains/arm-2011.V2/bin,我猜它是一个交叉编译工具链。在这种情况下,不能使用 curl 库,因为它是针对主机系统的,可能是 x86 或 x86_64 系统。
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.
要在您的 ARM 项目中使用 curl 库,如果可能,您需要为 ARM 安装 curl 库开发包。如果软件库没有这些包,那么您需要先下载源代码并为 ARM 交叉编译它。
回答by Addison
Make sure that you've got curl.hinstalled to your default location (LD_LIBRARY_PATH). If you don't, you can clone and install from GitHub.
确保您已curl.h安装到默认位置 ( LD_LIBRARY_PATH)。如果没有,您可以从GitHub克隆和安装。
Once you've cloned it, just use these commands:
克隆它后,只需使用以下命令:
./buildconf
./configure
make
cd include # ONLY install the include folder (with curl.h, etc)
make install
And you should be done. If you need further help, check the GIT-INFOfile in the base directory.
你应该完成。如果您需要进一步的帮助,请检查GIT-INFO基本目录中的文件。
回答by HymanNorthrup
This fixed it for me:
这为我修复了它:
sudo ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
回答by Amir
Try to use this. Find your curl.h file - it shoud be where you installed your curl '...\include\curl\curl.h' So instead of writing in your code this '#include ', write all path like here '#include '. It is possible to help you! Good luck )
尝试使用这个。找到你的 curl.h 文件 - 它应该是你安装 curl 的地方 '...\include\curl\curl.h' 所以不要在你的代码中写这个 '#include',写所有的路径像这里 '#include' . 有可能帮到你!祝你好运 )

