The question seems straight forward. I tried a lot of things just to include curl in my C project using the code::blocks ide but to no avail.
I would like to use cUR
Go to your project "Build Options" -> "Linker" tab and so you have two choices:
If your library is (correctly) installed system-wide, write in "other linker options" the libs as if you were using your compiler directly.
For GCC you'd write -lcurl
. You may also use this with a path instruction like Wl,-rpath,/path/to/your/library -lMyLib
. Obviously it depends on the compiler and system setup.
Add the library in "Link libraries" on the left. Click the "Add" button and browse to your library file.
Take a look at this A.3 — Using libraries with Code::Blocks for some pictures. Googling around will show you more.
The following steps are for windows 32 users. And the following steps worked for me after several hours. This may or may not work for you as I got it after several trial and errors. So thats why I am writing the steps in elaborate manner.
step1: start code blocks create an empty project with name proj_curl
step2: Open on this url www.paehl.com/open_source/?CURL_7.50.0
a) click Download without ssl
b) click Download libcurl.dll (all versions) only
c) click Download the Libray (all version) only
step3: open on this url curl.haxx.se/download/curl-7.50.1.zip - a zip file will be downloaded automatically. (sorry folks this site is not allowing me to insert more than 2 links, bear with me.)
Note: Now Totally You have 4 zip files downloaded
step4: create a folder in c drive(c:\libs\curl) extract all the folders files of the 4 zip files into the curl folder in c. Make sure to create each subdirectory for each zip file.
step5:(Very important)
In the curl folder of C drive, - click on curl.exe(a command prompt just appears for few millisecs.) - Go to code blocks -> Settings -> Compiler... -> Linker settings tab -> Add
"C:\libs\curl\lib\nossl\libcurl.a"
"C:\libs\curl\lib\nossl\libcurldll.a"
then -> search directories tab -> Compiler
then -> search directories tab -> Linker
Click ok
Step6: - open the folder "nossl" which came in the curl_DLL_ONLY.7z file.
Step7: Now test the working of the curl library with your c program.
Note: if you encounter an error "The program cant start because zlib1.dll is missing from your computer. Try reinstalling the program to fix this problem."
Solution: - copy and paste the url sourceforge.net/projects/mingw/files/latest/download
install the mingw-get-setup.exe by marking all the libraries.(takes about 10 min to install)
after installation, open C:\MinGW\bin, copy the zlib1.dll to the same directory as you did in step6 for libcurl.dll.
Thats it...