Qt, windows and _POSIX_
-
28-05-2021 - |
Question
I'm working on building Qt 4.8.1 in VisualStudio 2005 and I was getting an issue that the compiler could not find _fileno
.
After some research, I found that in stdio.h it has
#ifdef _POSIX_
_CRTIMP __checkReturn int __cdecl fileno(__in FILE * _File);
#else
_CRTIMP __checkReturn int __cdecl _fileno(__in FILE * _File);
#endif
I then looked through the qt code and found that qfsfilengine_win.cpp and qfilesystemengine_win.cpp both have
#define _POSIX_
It seems to me that this would be a mistake, and if I remove these lines, it seems to build successfully.
Does anyone know why these files would be defining _POSIX_
?
Thanks.
Solution
It seems that this is indeed a bug in Qt. If you are building Qt for windows without precompiled headers and you run into this problem, just delete the #define _POSIX_
calls in qfsfilengine_win.cpp and qfilesystemengine_win.cpp and it will build successfully.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow