I’m a mac user, when it comes to generic libraries I love to
One day a buddy (a fellow Mechanical Engineering guy) comes up with a windows laptop and he needs help with a VC++ win32 project which is supposed to make http calls to rotate a servo (fancy :>). Well one has to save his pride. So after lot of fiddle here’s how I did it on visual studio 2013 (shall work in similar way for others as well).
Clone this repository blackrosezy/build-libcurl-windows and go to the cloned directory and run build.bat.
This should build the library for any version of visual studio you have automatically. Although the README explicitly says All version of Visual Studio express are unsupported. Now you have built header files, library files and dlls in the third-party directory. It shall look like:
Now it’s time to add this to your VC++ win32 project. Create a new project or go to the existing project and follow these steps:
- Go to Project | Project Properties | VC++ Directories | Include Directories | Add the path to the include directory inside the third-party folder. (./third-party/include).
Note: do not add /third-party/include/curl as most of time it’s included as curl/curl.h in code.
- Next, go to Project | Project Properties | Linker | General | Additional Library Directories | Add the path to the lib directory. (Where libcurl_debug.dll is located). As my project was for x86 architecture I added ./third-party/lib/dll-debug-x86
- Then, go to Project | Project Properties | Linker | Input | Additional Dependencies | And add libcurl_debug.lib
- Now build the project, you can use this test code:
Note: If it throws error like libcurl_debug.dll is missing, it’s because the compiler is unable to find the dll file. Copy the libcurl_debug.dll file from /third-party/lib/dll-debud-x86 to the debug directory of your visual studio project and try to build again it should work.
This should give output as some HTML code.