c++ - Can't initialise an array -
okay, i'm pretty new when comes c++ (having moved on vb) , can't seem work out how populate array without doing:
array[0] = 1 array[1] = 2
etc etc
so expected, have tried this:
float posvector[3]; //declared outside of int main() needs global posvector = {0.0f,0.0f,0.0f}; //inside int main()
which causing error displayed:
extended initializer lists available -std=c++0x or -std=gnu++0x [enabled default]
nothing have been able locate online far has been of help. advice can give me on fixing appreciated!
once array declared cannot initialized using initializer list. can go with
float posvector[] = {0.0f,0.0f,0.0f};
or better go std::vector:
#include <vector> std::vector<float> posvector = {0.0f,0.0f,0.0f};
Comments
Post a Comment