4

I downloaded the libcurl library from https://curl.haxx.se/libcurl/
and i'm trying to include and compile it
but I get this error

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

even that I put the curl folder in the same directory

the command that I used to compile

 x86_64-w64-mingw32-gcc try.c -o a.exe -lws2_32 -lcurl

So I searched and I found these answers

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

so I did

sudo apt-get install  libcurl4-openssl-dev

but still not working what to do?

Nati V
  • 682
  • 4
  • 10
  • 17
  • What you need to have is a `curl` library for the target. It appears you are compiling for Windows target using `mingw`, so you need to cross-compile or download the curl library for Windows and use that library to link with. – ArturFH Jun 11 '17 at 22:04
  • Please include the code you are compiling (the #includes) – Erik W Jun 11 '17 at 22:41
  • If I understand your setup correctly, `-I.` on the gcc command line may do the trick. – zwol Jun 11 '17 at 23:28
  • Also, are you on Linux or are you on Windows? Or are you trying to "cross compile" from Linux _to_ Windows, which is extra-finicky? – zwol Jun 11 '17 at 23:29

1 Answers1

4

I solved it I just copied the curl directory that I downloaded to /usr/x86_64-w64-mingw32/include/

and when you compile you need to do -lcurl/curl

Thanks for your help

Nati V
  • 682
  • 4
  • 10
  • 17