Array woes!
I wish to make a multi dimentional array for my current tile engine, I declare my structure for texture selection like this:
struct tilemap_t
{
int texid;
};
an then the array like this:
tilemap_t tile[10][10];
However, Visual C++ reports the error !!! I have no idea, any thoughts?
There''s nothing wrong with what you''ve given, what is the exact error? And post a few lines around the code you''ve given. Often the error is not on the line that VC reports, but on a line above...
War Worlds - A 3D Real-Time Strategy game in development.
War Worlds - A 3D Real-Time Strategy game in development.
I think sometimes (depending on the compiler?), if you''re declaring a variable of a struct type you have to use:
struct tilemap_t tile[10][10];
instead of:
tilemap_t tile[10][10];
"All you need to do to learn circular logic is learn circular logic"
struct tilemap_t tile[10][10];
instead of:
tilemap_t tile[10][10];
"All you need to do to learn circular logic is learn circular logic"
"All you need to do to learn circular logic is learn circular logic"
I think BlueMonk has the answer. What you could do is make it into a type:
typedef struct {
int texid;
} tilemap_t;
then carry on as before
tilemap_t tile[10][10];
Hope that useful
typedef struct {
int texid;
} tilemap_t;
then carry on as before
tilemap_t tile[10][10];
Hope that useful

C++ implicitly typedefs classes and structures. This would only cause a problem if the compiler is using C rules (which it does only if you use files with the .c extension instead of .cpp)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement