We have a thread going in the game development forum here, but I'm at the stage of C++ specific questions and thought I should post in here to get some assistance.
It looks like I can't get away with using this #define variable in the array of structures creation statement. I get errors that what ever is between the [ and ] is basically not legal. I can understand it since it doesn't have a type so how do you work around this? This is probably something really simple that I'm not thinking of...
#include <cstdlib>
#include <iostream>
using namespace std;
#define max_locations 5;
#define max_directions 4;
typedef struct t_rooms {
int id_number;
char *roomname;
};
typedef struct t_locationinfo
{
int location_id;
char *description;
[b] t_rooms room_array[max_directions];[/b]//errors here
//tried this also using a created/named instance of the first struct rather
//than it's type and that generated MANY more compile errors than this one
};
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
Line 18: t_rooms room_array[max_directions];
gives these errors: "expected `]' before ';' token" and "expected unqualified-id before ']' token".
I have also tried to create this array using a named instance of the defined structure type and that generated a lot more errors than my current version of broken code.
What do you guys see wrong with my structure array?

New Topic/Question
Reply



MultiQuote


|