is there any restriction of data type in struct???

I am a newbe in c++/c. and recently I am trying to read data form a Collada file.so I have to define the data struct to store the parsed data in the memory.
I define the data structure in a head file. but when I compile it ,sth goes wrong.
the whole codes are so long.so I cut part of it, and guess that's enough to show the problem. the head file is listed as follows ,and also the error message.
/-----------------------------------------------------------------/
head file:Collada.h

#include <string>

struct Init_From
{
int num;
};

struct Image
{
Init_From m_Init_From;
};
struct ImagesLibrary
{
vector<Image> m_Images;
};
/---------------------------------------------------------------/

and source file where the winmain function is located:

#include "stdafx.h"
#include "Collada.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
ImagesLibrary *imglib;
while(1)
{


}
return 0;
}

/---------------------------------------------------/

the error message:

d:\program files\microsoft visual studio\myprojects\colladaloader\collada.h(22) : error C2143: syntax error : missing ';' before '<'
d:\program files\microsoft visual studio\myprojects\colladaloader\collada.h(22) : error C2501: 'vector' : missing storage-class or type specifiers
d:\program files\microsoft visual studio\myprojects\colladaloader\collada.h(22) : error C2059: syntax error : '<'
d:\program files\microsoft visual studio\myprojects\colladaloader\collada.h(22) : error C2238: unexpected token(s) preceding ';'
Error executing cl.exe.

/---------------------------------------------------------/

I was wondering if there is any restriction of data type in struct. like complex data types are not available here.
Making a struct creates a new data type. All of your errors are pretty self explanatory. If you edited this with some code tags, I'll look at it more
thanks for your suggestion. what do you mean by"if you edited this with some code tags,I will look at it more".


maybe I didn't explain it detail enough.

I made the data structure defined in a head file. and within a data structure ,there may be another data strucutre which is defined later in the file. I think that is where the error came from. because when I define a data structure whose elements are all built-in type such as int, float,char ... ,it runs well.

so the words above is my guess. and if I am right, could give me solution,or if I am wrong, could show me what's wrong
vector is in the std namespace. Try std::vector<Image> m_Images; and see if some of the other errors disappear.
Topic archived. No new replies allowed.