Reputation: 77904
I installed on windows curl 7.28.0
from curl-7.28.1-devel-mingw32.zip
through minGW
console to default directory like:
./config && make && make install
All needed headers (aka curl.h, types.h ...
) I see in C:\MinGW\msys\1.0\local\include\curl
libcurl.pc
placed in C:\MinGW\msys\1.0\local\lib\pkgconfig\
libcurl.a
, libcurl.dll.a
and libcurl.la
placed in C:\MinGW\msys\1.0\local\lib
.
My download_file.c
file includes are:
...
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
...
I try to compile the C
code with followed command through gcc
:
$ gcc -IC:/MinGW/msys/1.0/include/
-IC:/MinGW/msys/1.0/local/include/curl
-IC:/MinGW/msys/1.0/local/lib/pkgconfig
-o download_file download_file.c -llibcurl -lcurl
with absolute path get the same error:
gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
-o download_file download_file.c -llibcurl -lcurl
But I still get an error:
download_file.c:21:23: fatal error: curl/curl.h: No such file or directory compilation terminated.
row 21 is #include <curl/curl.h>
What I did wrong? Please help.
Upvotes: 2
Views: 9255
Reputation: 77904
Thank you very much to @0xC0000022L and @unwind. By your help I fixed my problem.
0xC0000022L you are right about absolute path
unwind you are right about -I/local/include/
instead -I/local/include/curl
I found other problem: -L/local/lib
instead -I/local/lib
.
So this is a working command:
gcc -I/include/
-I/local/include
-L/local/lib
-o download_file download_file.c -llibcurl -lcurl
Upvotes: 0
Reputation: 399863
You have the curl/
directory in the source code, but also in the option.
It seems the option should point out the higher-level directory in which curl/
is, so it should be something like:
-I/local/include/
Upvotes: 2
Reputation: 21289
I think the problem is likely that you give your include paths on the command line in the Win32 path format. This is not the same as the one used by msys (or ultimately Cygwin).
Try these:
$ gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
...
Hope I got the absolut paths right, but you can check in your msys shell.
What ticked me off was that you use ./config
, which wouldn't work from the Command Prompt, but works from the msys shell. So you need to give paths that all the programs in MinGW understand.
Basically, most programs in MinGW only have the concept of a single file system root, like on any unixoid system, while Win32 has multiple (the drive letters). Since the MinGW programs are linked accordingly, you need to give paths that they understand.
Upvotes: 1