error C2065: “M_PI_2”: 未声明的标识符。
在Visual Studio中使用math.h库时与其他数学库冲突时,可以通过宏_USE_MATH_DEFINES来消除math.h定义的宏。
D:\Windows Kits\10\Include\10.0.20348.0\ucrt\corecrt_math_defines.h
//
// corecrt_math_defines.h
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Definitions of useful mathematical constants
//
#pragma once
#ifndef _MATH_DEFINES_DEFINED
#define _MATH_DEFINES_DEFINED
#include <corecrt.h>
#pragma warning(push)
#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
_UCRT_DISABLE_CLANG_WARNINGS
// Definitions of useful mathematical constants
//
// Define _USE_MATH_DEFINES before including <math.h> to expose these macro
// definitions for common math constants. These are placed under an #ifdef
// since these commonly-defined names are not part of the C or C++ standards
#define M_E 2.71828182845904523536 // e
#define M_LOG2E 1.442695040