首页 > 解决方案 > gcc在其所在目录下找不到libcurl头文件

问题描述

我正在尝试使用以下命令编译 cpp:

g++ -IC:\Users\XXX\libcurl-7.56.0\libcurl-7.56.0\include\curl -LC:\Users\XXX\libcurl-7.56.0\libcurl-7.56.0\lib program.cpp

这个程序有一个使用 libcurl 的头文件。curl 库位于 -

C:\Users\XXX\libcurl-7.56.0\libcurl-7.56.0\include\curl\curl.h 

即使 curl.h 在路径中,gcc 也会出现以下错误 -I

mylibrary.h:26:10: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>

我究竟做错了什么?

标签: c++gccheaderlibcurl

解决方案


The error message means the file curl/curl.h could not be found in the search path specified by -I. You updated the question with the path to the file so the command should be:

g++ -IC:\Users\XXX\libcurl-7.56.0\libcurl-7.56.0\include -LC:\Users\XXX\libcurl-7.56.0\libcurl-7.56.0\lib program.cpp

Also, can you please try using \ instead of / as path separator in your mylibrary.h file:

#include <curl\curl.h>

推荐阅读