Qt _USE_MATH_DEFINES

1.2k Views Asked by At

I need to work with OpenMesh on my PC with Qt IDE, the snip of the simple *.pro file looks like:

DEFINES += _USE_MATH_DEFINES
DEFINES += NOMINMAX
#DEFINES += OM_STATIC_BUILD
#OpenMesh
INCLUDEPATH += "D:/Libraries/OpenMesh 6.3/include"
#Debug
LIBS += "D:/Libraries/OpenMesh 6.3/lib/OpenMeshCored.lib"
LIBS += "D:/Libraries/OpenMesh 6.3/lib/OpenMeshToolsd.lib"
# Release
LIBS += "D:/Libraries/OpenMesh 6.3/lib/OpenMeshCore.lib"
LIBS += "D:/Libraries/OpenMesh 6.3/lib/OpenMeshTools.lib"

However, I still got the error message: "C1189: #error: "You have to define _USE_MATH_DEFINES in the compiler settings!" Can anyone help me?

2

There are 2 best solutions below

1
On

The same error occured to me, but with MSVC 2019 16.6.1

Adding the define _USE_MATH_DEFINES in front of my OpenMesh include statement solves the problem for me.

#define _USE_MATH_DEFINES
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>

The forum Post How does #define _USE_MATH_DEFINES work? helped me to understand the functionality behind the define.

0
On

if you wanna run your application from Qt creator for any reason as using qmake, you just have to add "DEFINES += _USE_MATH_DEFINES" to your *.pro file