Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » "Two or more data types in declaration" error

This thread is locked; no one can reply to it. rss feed Print
"Two or more data types in declaration" error
madpenguin
Member #2,201
April 2002
avatar

Hi all,

I am trying to include a C header into a C++ program. In this header, I have the following:

1 typedef struct
2 {
3 //char ident[4];
4 int ident;
5 int version;
6 int skin_width; /* ignored - this is filled later when loading the texmap */
7 int skin_height; /* ignored - this is filled later when loading the texmap */
8 int frame_size;
9 int num_skins; /* ignored */
10 int num_vertices;
11 int num_texture_coords;
12 int num_triangles;
13 int num_gl_commands;
14 int num_frames;
15 int offset_skins; /* ignored */
16 int offset_texture_coords;
17 int offset_triangles;
18 int offset_frames;
19 int offset_gl_commands;
20 int offset_end;
21 } MD2_HEADER_STRUCT;

When I compile, I get:

Quote:

md2_model.h:31: error: two or more data types in declaration of 'MD2_HEADER_STRUCT'

...and wrapping the include up in extern "C" { didn't fix it. Has anyone seen this before and knows what it might be?

Posted here because it's not really allegro-related.

---------------------------------------------
Cynicism field generator is enabled and operating at 97% of capacity

le_y_mistar
Member #8,251
January 2007
avatar

it's programming related, isnt there a programming sub forum?

-----------------
I'm hell of an awesome guy :)

bamccaig
Member #7,536
July 2006
avatar

There appears to be nothing wrong with the code you posted. I compiled it fine as C code. Google searches suggest that a function (or something) is declared with 2 data types... For example...
int char func(void); // More than one data type.
I guess make sure you're giving us the offending code and/or look for a declaration with two data types.

Thomas Fjellstrom
Member #476
June 2000
avatar

Which line is line 31?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kibiz0r
Member #6,203
September 2005
avatar

My guess is a missing ; or } above it.

Go to: