Windows compilation problem
-
Hello,
I have been using Qt for a long time now, but not for windows. I tried to recompile one of my apps (working well with linux and MacOS) for windows, so I configured a kit with Qt 6.5 LTS and MinGW (tried both MinGW11 and 13 that were installed by the Qt installation tool).
I get errors like "variable CreateSyntheticPointerDevice definition is marked as dllimport" and the likes, several times. I spent some time looking on internet and trying to understand and decided to simplyfy the problem by generating a new empty Qt project, and I get the same compilation errors.
The function CreateSyntheticPointerDevice is declared in winuser.h as :
WINUSERAPI HSYNTHETICPOINTERDEVICE WINAPI CreateSyntheticPointerDevice( ....)
Other functions marked as WINUSERAPI WINAPI does not seem to be problematic, so the problem could be linked to the HSYNTHETICPOINTERDEVICE marking.
I don't know how to fix this, any help greatly appreciated ... -
Hello,
I have been using Qt for a long time now, but not for windows. I tried to recompile one of my apps (working well with linux and MacOS) for windows, so I configured a kit with Qt 6.5 LTS and MinGW (tried both MinGW11 and 13 that were installed by the Qt installation tool).
I get errors like "variable CreateSyntheticPointerDevice definition is marked as dllimport" and the likes, several times. I spent some time looking on internet and trying to understand and decided to simplyfy the problem by generating a new empty Qt project, and I get the same compilation errors.
The function CreateSyntheticPointerDevice is declared in winuser.h as :
WINUSERAPI HSYNTHETICPOINTERDEVICE WINAPI CreateSyntheticPointerDevice( ....)
Other functions marked as WINUSERAPI WINAPI does not seem to be problematic, so the problem could be linked to the HSYNTHETICPOINTERDEVICE marking.
I don't know how to fix this, any help greatly appreciated ...@oliver_mpt said in Windows compilation problem:
The function CreateSyntheticPointerDevice is declared in winuser.h as :
I don't know but have a read through https://www.reddit.com/r/gcc/comments/u0q721/how_to_compile_a_shared_library_that_uses_types/ . That was from 3 years ago and said
You'll need a very recent version of Mingw-w64. You'll also need to define NTDDI_VERSION to at least NTDDI_WIN10_RS5
Maybe the discussion there will help for this particular issue? Also https://discuss.kde.org/t/kirigami2-for-developement-on-windows-rant/6333/16.
If the error comes from Qt sources rather than your own I do not know why it does not run through and compile/link correctly. I do not use Windows for Qt.
-
Thank you very much @oliver_mpt
I get the same problem trying to compile CopyQ 14.0 against Qt 6.11.0 on Windows 11.Thank you very much @JonB
I was using version 11 and tried using a newer MinGW-w64, and I managed to compile using version 14. But it fails to link. I'm too ignorant about Qt, C++ and C toolchains to judge, but there is a good chance that going from version 11 to 14 suffices to fix that specific issue. I did not need to define NTDDI_VERSION.Unfortunately I do not know for sure because I got version 14 from MSYS2 instead of Qt, so they're very different beasts, which is very likely to explain the linking failure.
How were you able to get MinGW-w64 13 from Qt? One thing I noticed is it's complicated to see which version of MinGW-w64 a directory contains.
-
Thank you very much @oliver_mpt
I get the same problem trying to compile CopyQ 14.0 against Qt 6.11.0 on Windows 11.Thank you very much @JonB
I was using version 11 and tried using a newer MinGW-w64, and I managed to compile using version 14. But it fails to link. I'm too ignorant about Qt, C++ and C toolchains to judge, but there is a good chance that going from version 11 to 14 suffices to fix that specific issue. I did not need to define NTDDI_VERSION.Unfortunately I do not know for sure because I got version 14 from MSYS2 instead of Qt, so they're very different beasts, which is very likely to explain the linking failure.
How were you able to get MinGW-w64 13 from Qt? One thing I noticed is it's complicated to see which version of MinGW-w64 a directory contains.
@Philippe-Cloutier said in Windows compilation problem:
How were you able to get MinGW-w64 13 from Qt? One thing I noticed is it's complicated to see which version of MinGW-w64 a directory contains.
See https://wiki.qt.io/MinGW. Qt is using binaries from https://github.com/niXman/mingw-builds-binaries/releases
-
@cristian-adam: Unfortunately that page does not indicate how to get version 13 (or any other).
-
@cristian-adam: Unfortunately that page does not indicate how to get version 13 (or any other).
@Philippe-Cloutier said in Windows compilation problem:
Unfortunately that page does not indicate how to get version 13 (or any other).
You did read the page, right?
Qt 6.8.0 -> mingw-builds 13.1.0-202407240918mingw1310
-
@Christian-Ehrlicher: If I hadn't read it, I would not have edited it nor created the talk page to say the table you refer to is unclear.
However, reading a page does not necessarily involve consulting every link, downloading the linked packages and analyzing them. If you are suggesting mingw-builds 13.1.0-202407240918mingw1310 contains MinGW 13, I doubt Oliver installed Qt 6.8.0, since he does not mention it and that had been superseded a while before he posted. Qt online installer 4.11.0 is not offering me Qt 6.8.0. -
@Christian-Ehrlicher: If I hadn't read it, I would not have edited it nor created the talk page to say the table you refer to is unclear.
However, reading a page does not necessarily involve consulting every link, downloading the linked packages and analyzing them. If you are suggesting mingw-builds 13.1.0-202407240918mingw1310 contains MinGW 13, I doubt Oliver installed Qt 6.8.0, since he does not mention it and that had been superseded a while before he posted. Qt online installer 4.11.0 is not offering me Qt 6.8.0.@Philippe-Cloutier Qt 6.8 -> mean Qt 6.8 and up as you can easily see from the other rows where not all Qt versions are mentioned...
-
@Christian-Ehrlicher: If " ->" means "and up", that's unusual, and it means 6.11.0 would contain both mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev3 and mingw-builds 13.1.0-202407240918mingw1310.
In any case, unless you are saying that one of these contains MinGW 13, I do not see your point.