Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 'M_PI': undeclared identifier [duplicate]

I'm trying to compile a library in C++ as dll windows with visual studio 2017.

I have all C++/H compiled with clang 3.8 for android and it works.

I created a new project as dynamic library with LLVM as platform toolset. Now I'm trying to build but there is an error :

Error C2065 'M_PI': undeclared identifier

This error is present in many .cpp files. All linked .h contains :

#include <cmath>

I replaced by :

#define _USE_MATH_DEFINES // for C++  
#include <cmath>

But it change nothing. What can I do ?

like image 629
A.Pissicat Avatar asked Sep 15 '25 09:09

A.Pissicat


1 Answers

This is a known issue, try defining _USE_MATH_DEFINES as a definition in your project properties instead of the file itself.

This can be found in project properties -> C/C++ -> Preprocessor -> Preprocessor definitions.

like image 64
Hatted Rooster Avatar answered Sep 17 '25 00:09

Hatted Rooster