iphone - C++ Struct in array, help! -


i have iphone app used use array of several thousand small objects data source. now, trying make use c++ structs, improve performance. have written struct, , put in "particle.h":

typedef struct{    double changex;    double changey;    double x;    double y; }particlestruct; 

then, imported "particle.h", , attempted define array:

#import "particle.h" @implementation particledisplay struct particlestruct particles[];    ///size determined later, declaration make   ////the declaration visible entire class... 

on line, however, error: "array type has incomplete element type". else compiles fine, far can tell, , sure "particle.h" has been imported before declaration. ideas?

since have typedefed in particle.h, drop word struct array declaration line (the line error is).

however,

  • in c++, not need typedef it, write struct particle { /* members */ };

  • why declaring array without length? consider using std::vector (tutorial) dynamically re-sizeable array (you don't have bother length ever). simple as: std::vector< particle > particles;


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -