c++ - gcc error "expected ')' before '[' token" -


i receiving these errors while attempting compile program gcc , i'm not sure whats causing them.

functions.h:21: error: expected ')' before '[' token functions.h:22: error: expected ')' before '[' token functions.h:23: error: expected ')' before '[' token functions.h:25: error: expected ')' before '[' token functions.h:26: error: expected ')' before '[' token functions.h:27: error: expected ')' before '[' token 

my program compiles fine in visual studio 2012.

heres header file seems causing errors.

struct subject {     char year[5];     char session;     char code[8];     char credit[3];     char mark[4]; };  struct data {     char name[30];     char id[30];     char cc[30];      char course[80];     struct subject subjects[30];     int gpa; };  void displayrecord(data [], int); int namesearch(data [], char [], int [], int); void editrecord(data [], int, int); char getchar(const char [], int); int getdata(data []); void displaydata(data []); void deleterecord(data [], int, int); 

i'm invoking compiler this:

 gcc -o test functions.cpp functions.h main.cpp 

i'm stumped appreciated!

my psychic debugging powers tell me visual studio compiling code c++ while gcc compiling c. since you're missing struct keyword before data in function parameters c compiler doesn't know do. try running through g++ instead of gcc (and possibly make sure including source file's extension .c or .cpp.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -