c++visual-studioc++17inline-variable

Using inline variables in visual studio


I am currently using Visual Studio 2017 Community Edition and I tried to declare this in my header file:

inline static int counter{1};

Now VS underlines it red and tells me that 'inline' can only be used for functions, although it should be possible since C++17.

Is there a way to still use it in VS or do I have to work around?


Solution

  • As of Nov. 15, 2017, inline variables are scheduled to be supported in Visual Studio 15.5. You can see the "current" status of features here or here .