typedef struct _BoundingVolume
{
ExpandedVolume encloseVolume;
Geometry *geom;
_BoundingVolume *leftChild;
_BoundingVolume *rightChild;
Vec3f h;
} BoundingVolume;
But VS .NET doesn't whant to compile it? I can't understand why because I have wrote and used this data type on a different program.
I get this error message:
error C2061: syntax error : identifier '_BoundingVolume'
[edited by - SiCrane on June 9, 2004 5:34:11 PM]
🔒 Locked
linked list in c problem
Advertisement
Original Post
I have just copy pasted this piece of code from one project to another.
Have the other types you used been declared?
P.S. Generally ''bad'' language isn''t considered appropriate in the forums outside of the L*unge.
P.S. Generally ''bad'' language isn''t considered appropriate in the forums outside of the L*unge.
Sorry about the bad language. This #¤%&#¤%& code just drives me insane.
I have defined the other datatypes above _BoundingVolume in my header.
AND, the code have worked on other projekt.. :[
Bah!
Ok!
I tried to an extremely simple linked list
Still the same error message.. THIS SHOULD work. What the hell is wrong with my compiler. It do work if i start a new project and just define this single datatype och and declare it in the main func.. ??!?!
I tried to an extremely simple linked list
typedef struct _ll
{
_ll *next;
int i;
} LL;
Still the same error message.. THIS SHOULD work. What the hell is wrong with my compiler. It do work if i start a new project and just define this single datatype och and declare it in the main func.. ??!?!
Perhaps the thing immediately before it is missing a semicolon, or missing a closing brace. Usually errors that make no sense are because of a problem immediately above.
Another unlikely possibility is that you''ve #defined typedef or struct.
Another unlikely possibility is that you''ve #defined typedef or struct.
Doesn''t seem to be that. I defined the struct in several different files and compiled... Same error
And I have not define struct of typedef..
Ahh..
try this:
typedef struct STRUCTNAME_BLAH {
float x, y;
};
STRUCTNAME_BLAH myInstance;
I think that if you are using typedef, that you don''t want to have the variable declared in the same statement. I don''t remember exactly, but i''ve had the same problem before and did something similar to what i stated to fix it.
typedef struct STRUCTNAME_BLAH {
float x, y;
};
STRUCTNAME_BLAH myInstance;
I think that if you are using typedef, that you don''t want to have the variable declared in the same statement. I don''t remember exactly, but i''ve had the same problem before and did something similar to what i stated to fix it.
typedef struct _ll
{
struct _ll *next;
int i;
} LL;
You need to use the non-typedef''d struct name if you want to have a pointer to its own type, with the word struct before it too.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Yes!! Thanx!
I guess the reason that my code didn''t work was because that it is a pure c program. My old program that i ripped the code from whas a c++ program without OO.
No problemo. Now wash your mouth out with soap!
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
quote:
Original post by OOCCO
Surely it should be
typedef struct _ll
{
LL *next;
int i;
} LL;
That doesn''t work in ANSI C. The typedef name hasn''t been parsed by the time it sees the LL* declaration.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement