objective c - Data definition has no type or storage class with float array definition -


i'll find answer enough blind experimentation or better google search, but.. might benefit others.

this not inside class definition, in .m objective-c file. i've got declaration of float array giving me following 2 warnings in xcode. errors show on declaration line, not assignment line.

data declaration has no type or storage class. type defaults 'int' in declaration

then assignment fails - if variable defaulting int, happen.

here's code. first declaration (static const float array initializer) doesn't give error, nor second (simple float). third , forth (float arrays) do.

static const float offset3d[4] = {     0.0, 0.0, -2.0, 0.0 }; float boxv; float boxv0[3]; float boxv1[3];  boxv0[0] = -0.5; // gives error of trying assign float (default) int 

you need put boxv0[0] = -05.; inside method somewhere. each of declarations should work, , assignment should fail. first assignment works because assign declared array- acceptable because compiler can create memory location , fill it. last 1 fails because attempt modify dynamically outside class method, compiler not allow. finally, if getting warnings on declarations, might have else going on.


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -