Thursday, September 1, 2022

[SOLVED] How to build/install libcurl on windows with MinGW

Issue

I have installed MinGW-w64 with MSYS to compile a project I built on Linux on Windows. I do not want to use MSVC, though I did find info on how to build libcurl with it. On Linux I just installed libcurl with "pacman -S libcurl" and could do.

#include <curl/curl.h>
...

I tried to install the precompiled libraries for windows from https://curl.se/windows/ but I have no idea where to put the files from "include" and the files from "lib"

EDIT

I checked https://curl.se/download.html and it seems like I only need the headers and not the all the binaries since curl is already installed on Windows 10. However the only ways there seems to be to install libcurl header files is either with vcpkg which I do not really want to use and cygwin which seems redundant because I have MinGW-w64 installed. Is there a way to install the libcurl package without vcpkg or cygwin.


Solution

I found a solution! On MSYS2 just do "pacman -Sy mingw-w64-x86_64-curl" which installs the binaries and the header files. The info was here https://everything.curl.dev/get/windows/win-msys2 and I have no idea why this is not in the curl downloads page or why MinGW on MSYS is not mentioned at all.



Answered By - ProgramMeALife
Answer Checked By - Katrina (WPSolving Volunteer)