尽管看起来一切正常,但仍然会得到“curl/curl.h:没有这样的文件或目录”
我在windows curl 7.28.0上安装了curl-7.28.1-devel-mingw32.zip,通过minGW控制台安装到默认目录,如:尽管看起来一切正常,但仍然会得到“curl/curl.h:没有这样的文件或目录”,c,curl,mingw,C,Curl,Mingw,我在windows curl 7.28.0上安装了curl-7.28.1-devel-mingw32.zip,通过minGW控制台安装到默认目录,如: ./config && make && make install 所有需要的标题都是curl.h,types.h。。。我在C:\MinGW\msys\1.0\local\include\curl中看到 libcurl.pc放在C:\MinGW\msys\1.0\local\lib\pkgconfig中\ libc
./config && make && make install
所有需要的标题都是curl.h,types.h。。。我在C:\MinGW\msys\1.0\local\include\curl中看到
libcurl.pc放在C:\MinGW\msys\1.0\local\lib\pkgconfig中\
libcurl.a、libcurl.dll.a和libcurl.la放在C:\MinGW\msys\1.0\local\lib中
我的下载文件.c包括:
...
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
...
使用绝对路径时,获得相同的错误:
gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
-o download_file download_file.c -llibcurl -lcurl
但我仍然得到一个错误:
download_file.c:21:23: fatal error: curl/curl.h: No such file or directory compilation terminated.
第21行包括
我做错了什么?请帮忙 我认为问题可能是您在命令行上以Win32 path格式提供了include路径。这与msys或最终Cygwin使用的不同 试试这些:
$ gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
...
希望我的绝对路径正确,但你可以检查你的msys外壳
让我恼火的是您使用了./config,它在命令提示符下不起作用,但在msys shell中起作用。因此,您需要给出MinGW中所有程序都能理解的路径
基本上,MinGW中的大多数程序只有一个文件系统根的概念,就像任何unixoid系统一样,而Win32有多个驱动器号。因为MinGW程序是相应链接的,所以您需要给出它们理解的路径。源代码中有curl/目录,但选项中也有
该选项似乎应该指出curl/is所在的更高级别目录,因此应该类似于:
-I/local/include/
非常感谢@0xC0000022L和@unwind。在你的帮助下,我解决了我的问题 0xC000002L关于绝对路径,您是对的 关于-I/local/include/而不是-I/local/include/curl,您是对的 我发现了另一个问题:-L/local/lib而不是-I/local/lib 这是一个有效的命令:
gcc -I/include/
-I/local/include
-L/local/lib
-o download_file download_file.c -llibcurl -lcurl
等等,您在msys中编译,但在minGW下为Win32 Path?msys/1.0提供我的默认文件夹。我在那里安装和编译了很多东西,比如openssl、iLBC、msx264和其他东西。请看我的答案。我认为问题在于您提供的包含路径。感谢您的回复,请参阅我的修复,我得到了相同的错误:。顺便说一句:当我试图用openssl编译项目时,我运行了:gcc-IC:/MinGW/msys/1.0/include/-IC:/MinGW/msys/1.0/include/openssl/-LC:/MinGW/msys/1.0/local/ssl/lib/-o openssl_-aes openssl_-aes.c-lcrypto-lgdi32,但它运行得很好,没有意识到问题的这一部分+1.
gcc -I/include/
-I/local/include
-L/local/lib
-o download_file download_file.c -llibcurl -lcurl