0

I have got the following problem:

I want to use M_PI defined in math.h. In order to do that, one should define _USE_MATH_DEFINES before including the header.

The following solution works correctly:

#define _USE_MATH_DEFINES

and then

#include < math.h >

However, I would like to add the definition of _USE_MATH_DEFINES to the Preprocessor Definitions (Project->Properties->C/C++->Preprocessor->Preprocessor Definitions). If I add _USE_MATH_DEFINES there, M_PI is not recognized (as without defining the constant at all).

Why is that so? Do you have any ideas?

4

1 回答 1

2

我在我的 Visual C++ 2010 express 上完成了你所有的步骤,它对我有用。

可能您在调试模式属性中设置宏并尝试在发布模式下编译它,或者在发布模式下设置并尝试在调试模式下编译。在发布和调试模式属性中添加宏,并尝试重建 ( ctrl+alt+F7) 您的项目。

于 2011-02-15T12:52:28.520 回答