0

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?

Tyler Xie
  • 169
  • 1
  • 3
  • 13
  • Plus, I also try to add "#define _USE_MATH_DEFINES" at the top of the 'compiler.hh' file in which the error appear. Then, the error message will disappear in building. But, the program will crash once I run it. – Tyler Xie May 16 '17 at 02:10
  • These problems gone away when i used vs2015 with qt plugin. And I also set _USE_MATH_DEFINES and NOMINMAX in vs2015 IDE. – Tyler Xie May 17 '17 at 06:21

2 Answers2

2

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

Mostafa Mahmoud
  • 182
  • 1
  • 10
0

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.