Gamster Katalin Gamster Katalin - 3 months ago 17
C++ Question

C++11 constexpr compilation error

I am trying to declare a

constexpr
and it throws compilation errors.

static constexpr float goBaseMovementSpeed = (1.135f / 440.f);


Why is this line not working?


error C2144: syntax error : 'float' should be preceded by ';'

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


goBaseMovementSpeed
is a member of a class.

Compiler: Visual Studio 2013

Answer

Visual Studio 2013 does not support all the C++11 features. In the same time it supports tiny part of C++14 features like std::make_unique for example.

constexpr is not supported on Visual Studio 2013.

For the full list: https://msdn.microsoft.com/en-us/library/hh567368.aspx

Comments