MichalBusta / FASText

Efficient Unconstrained Scene Text Detector
GNU General Public License v2.0
191 stars 74 forks source link

M_PI_2 undefined (Visual Studio 2017) #41

Closed Th-Havy closed 5 years ago

Th-Havy commented 5 years ago

Hi, I have built the library with CMake and Visual Studio but obtained the following error: 'M_PI_2' undeclared identifier.

After some digging around, I have found the reason which is specific to Visual Studio. The math constants are not defined by default in it, see this post.

There are two possible workaroun: 1: #define _USE_MATH_DEFINES before including cmath (not sure where it is included in this library) or 2: in geometry.h, there is a preprocessor command to define M_PI if it is not yet defined, so a similar preprocessor command can be added: #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923
#endif

Hope it can be helpful.