Exclude qmath.h from build
-
-
I can include math.h and qmath.h without getting any compiler warnings or errors here.
What Qt-version and MSVC compiler do you use?This is working fine:
#include <math.h> #include <qmath.h> int main(int argc, char** argv) { return 0; }
The order of the both includes also don't matter.
-
@Christian-Ehrlicher MSVC2013. Qt creator 4.14.2 Qt 5.15.2
the solution you suggested is tried already. That didn't work for me somehow.
Let me try once again and confirm. -
Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html
-
@Christian-Ehrlicher said in Exclude qmath.h from build:
Qt5.15 can not be use with this ancient compiler: https://doc.qt.io/qt-5/supported-platforms.html
I have installed VS2019 now. With MSVC2013 I don't have errors. Now I have lot of errors with my previous warnings intact. It is between qmath.h and corecrt_math_defines.h. What could be the problem?
-
@gmk27 said in Exclude qmath.h from build:
What could be the problem?
You're still using the old compiler I would guess.
-
@Christian-Ehrlicher No buddy. I have uninstalled VS2013 before installing the 2019 version. It is not even in the KITS, I checked everything.
-
Please also make sure that not an old WinSDK is installed and used.
The corecrt_math_defines.h must contain something like this:#ifndef _MATH_DEFINES_DEFINED #define _MATH_DEFINES_DEFINED // Definitions of useful mathematical constants // // Define _USE_MATH_DEFINES before including <math.h> to expose these macro // definitions for common math constants. These are placed under an #ifdef // since these commonly-defined names are not part of the C or C++ standards
qmath.h properly defines _USE_MATH_DEFINES (line 50)
-
@Christian-Ehrlicher - Yes, I see there are proper guard checks in corecrt_math_defines.h. BTW I have Windows 10 SDK installed. I believe it is the latest one. I tried to reproduce the warnings by creating a new Qt project (as in your 1st reply to this post) but these warnings are not popped up, interestingly. Point to note is - these warnings are coming even if I don't include the <qmath.h> in my existing project. I have checked whole project it is nowhere included. In the new project it is just fine (with either files included or only one).
Where should I look exactly to fix this kind of issue?
Just to remind my platform - Qt 5.15 and MSVC2019 kit