user7238425 user7238425 - 2 months ago 47
C++ Question

Enable c++14 in visual studio 2015 cmake

I am trying to have a dynamically sized array on the stack.
I have the following code

int length = 0;
getLength(&someVar, &length);

char infoLog[length];

but I can't do it.
I originally developed the code on macOS and had no problem compiling it.
I did some research and found out c++14 supports this, but I am not sure how to turn it on in CMake (or in VS2015 community edition).


EDIT: As drescherjm showed it wasn't actually added to the spec. Did it as per the answer below.


No, C++14 does not support it.

Try using a dynamic container instead:

std::vector<char> infoLog(length);