Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

M_PI in VS2010: working in Debug conf but not in Release

In my unmanaged C++ source i have:

#define _USE_MATH_DEFINES
#include <cmath>

and then I use M_PI a couple of times. Compiling in Debug configuration works flawlessly but in Release it gives:

error C2065: 'M_PI' : undeclared identifier

What could be the configuration property causing this?

like image 715
Spookyone Avatar asked Nov 02 '10 12:11

Spookyone


1 Answers

Solved.

I had put

#define _USE_MATH_DEFINES

before

#include "stdafx.h"

With Precompiled Headers on (/Yu), as it's in Release mode, everything above it is ignored.

like image 57
Spookyone Avatar answered Sep 28 '22 08:09

Spookyone