I'm learning C++ and I have a problem. I have this declaration in a class header file:
double bgal[3][3] =
{ { -0.066988739415,-0.872755765852,-0.483538914632 },
{ 0.492728466075,-0.450346958020, 0.744584633283 },
{ -0.867600811151,-0.188374601723, 0.460199784784 } };
With Visual Studio 2015 compiles fine, but with Visual Studio 2013 it doesn't compile. I get this message:
cannot specify explicit initializer for arrays
I think the problem is related that Visual Studio 2013 doesn't support C++11 and Compiler Error C2536.
I have tried to move that initialization inside the class constructor, but it doesn't work. This:
MyClass::MyClass() : bgal { { -0.066988739415, -0.872755765852, -0.483538914632 },
{ 0.492728466075, -0.450346958020, 0.744584633283 },
{ -0.867600811151, -0.188374601723, 0.460199784784 } }
But it doesn't work.
Any advice? Maybe I can't make this vector constant or static, or...
I have tried bgal[0][0] = { ...}; bgal[0][1] = { ...};
but it is a lot of work.
It is not a duplicate of question Error: cannot specify explicit initializer for array because that question asks about a one dimension array, and it offers as a solution to initialize the array with bgal[0][0] = { ...}; bgal[0][1] = { ...};
that it is a lot of work. And I asking if there is another way to do it faster.
Please read the question carefully before looking for possible duplicate questions.