C++11 constexpr 编译错误
C++11 constexpr compilation error
我正在尝试声明一个 constexpr
并且它抛出编译错误。
static constexpr float goBaseMovementSpeed = (1.135f / 440.f);
为什么这条线不起作用?
error C2144: syntax error : 'float' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
goBaseMovementSpeed
是 class 的成员。
编译器:Visual Studio 2013
Visual Studio 2013 不支持所有 C++11 功能。同时它支持 C++14 特性的一小部分,例如 std::make_unique
。
constexpr
在 Visual Studio 2013 上不受支持。
完整列表:
https://msdn.microsoft.com/en-us/library/hh567368.aspx
我正在尝试声明一个 constexpr
并且它抛出编译错误。
static constexpr float goBaseMovementSpeed = (1.135f / 440.f);
为什么这条线不起作用?
error C2144: syntax error : 'float' should be preceded by ';'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
goBaseMovementSpeed
是 class 的成员。
编译器:Visual Studio 2013
Visual Studio 2013 不支持所有 C++11 功能。同时它支持 C++14 特性的一小部分,例如 std::make_unique
。
constexpr
在 Visual Studio 2013 上不受支持。
完整列表: https://msdn.microsoft.com/en-us/library/hh567368.aspx