I am trying to use a third party library in my C program, in this particular case the library is curl.
My folder structure is as follows:
Root
-curl
-main.c
The curl folder the cloned Curl repo from github.
My main.c file has the appropriate header file included, as mentioned in curl docs.
How do I compile, link or prepare the curl folder that I cloned so I can use it in my project?
Follow the curl documentation to compile curl into a static or shared library.
If you install the compiled curl library into your system, then you just compile your main program and link against curl: -lcurl. Your compiler will find curl installed In the system, and also find the include folder In the system automatically.
If you didnt want to install curl into the system, then install it into your projects directory under a "deps/curl" then link against the file in that local folder, and add the include folder path when compiling. For example, linking against the static lib in your local application folder.
gcc -o app -I ./deps/curl/include -l ./deps/curl/lib/curl.a