As I understand it, it is not practical to use the MS SDK with the mingw compiler. You have to use a mingw specific SDK. And even the most up-to-date mingw releases appear not to support GetPhysicalCursorPos.
Since you only need this one function, or perhaps this one and a handful of others, it is easy enough to supply the missing parts of the SDK yourself. For example:
#define WINVER 0x0600
#include <windows.h>
#include <iostream>
extern "C"
{
__declspec(dllimport) BOOL WINAPI GetPhysicalCursorPos(LPPOINT lpPoint);
}
int main()
{
POINT pt;
if (GetPhysicalCursorPos(&pt))
{
std::cout << pt.x << ", " << pt.y << std::endl;
}
}
Here we include a declaration of the API we wish to call. When you compile this you get the following error:
>g++ main.cpp -o main.exe
>C:\Users\xxx\AppData\Local\Temp\ccCCZZEk.o:main.cpp:(.text+0x1d): undefined
reference to `__imp_GetPhysicalCursorPos'
collect2.exe: error: ld returned 1 exit status
So we need to find a way for the linker to be able to resolve the symbol. In theory you can ask the linker, ld, to link to DLLs directly. But I have not been able to get that to work. Instead you can use a somewhat more laborious approach.
Make a .def file to define the exports of the user32 library where this function lives:
LIBRARY user32.dll
EXPORTS
GetPhysicalCursorPos = __imp_GetPhysicalCursorPos
Save that to a file named myuser32.def. Now, that's not all the functions that user32 exports, but we only want the ones that are missing from the import library that comes with mingw.
Now use dlltool to make an import library:
>dlltool -d myuser32.def -l myuser32.a
And then compile passing the import library:
>g++ main.cpp myuser32.a -o main.exe
Success this time. When we run the program:
>main
1302, 670