#### Archived

This topic is now archived and is closed to further replies.

# Weird Dev C++ class/struct errors

## Recommended Posts

Rebooted    612
I keep getting weird errors from Dev-C++ with code that works on MSVC. This is whats basicly happening:
struct MyStruct
{
int MyInt;
};

class MyClass
{
MyStruct TheStruct;
};

int main(int argc, char *argv[])
{
XXfile file;
system("PAUSE");
return 0;
}

I get an "''MyStruct is used as a type, but not defined as a type error''", and only when i create the struct in a class. If I made one in the main function it would compile properly. I also tried using:
typedef struct _MyStruct
{
int MyInt;
}MyStruct;

Am I missing something? Like I said, it works fine in VC++.

##### Share on other sites
Rebooted    612
Woops stupid error. I had to define the struct before the class. Really sorry.