I want to include curl.h
to use the functions included there for my C program and I downloaded them. By them I mean to say .h
,.c
,.a
files i.e. a whole library(curl library). Following is the location to curl.h
:
C:\CURL\include\curl
Following is the location to libcurl.a
:
C:\CURL\lib
The problem is that I am not able to compile the program correctly as I am thrown error each time.
I tried including path where curl/curl.h
resides:
gcc -IC:/CURL/include test.c -o run -lcurl
Error I get:
C:/Program Files (x86)/Embarcadero/Dev-Cpp/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcurl
collect2.exe: error: ld returned 1 exit status
Thinking opps, I should have given the path to libcurl.a
, I tried including path where curl/curl.h
resides and path where libcurl.a
resides(i don't know if it is corrent to use -I
twice):
gcc -IC:/CURL/include -IC:/CURL/lib -lcurl test.c -o run
I was still wrong and Error I get:
C:/Program Files (x86)/Embarcadero/Dev-Cpp/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcurl
collect2.exe: error: ld returned 1 exit status
I also tried replacing -lcurl
with -llibcurl
,-llibcurl.a
,curl.a
while keeping other syntax unchanged for the sake of satisfaction or something like touch and go of if this could be right or that could be right way.
Had I ever entered correct syntax for compiling?
Where am I mistaken in compilation? Please help me in this. Suggest the correct and best way to compile and if possible with makefile
.