How to use the Windows API in MinGW?

Viewed 41175
3 Answers

In case if you installed MinGW as a part of MSYS on Windows then you can install Windows.h and other Win-API headers through following command inside MSYS shell:

pacman -S msys2-w32api-headers msys2-w32api-runtime

then header is located in

c:/MSYS_PATH/usr/include/w32api/windows.h

also you can search any package name (or sub-name) through e.g.

pacman -Ss w32api


If you're on Linux then Windows.h can be installed through

sudo apt install mingw-w64-common

then header is located here

/usr/share/mingw-w64/include/windows.h

you may probably need to include compiler's option

-I/usr/share/mingw-w64/include/

Related