I'm trying to write a C++ program that uses some compound structs and vectors, and I'm getting a compile time error: multiple types in one declaration.

Here's the form my code's in:

#include <vector>
using namespace std;

struct Struct2 {
    int value1;
    int value2;
}; // end Struct2

struct Struct1 {
    int value;
    vector<Struct2> vec;
}; // end Struct1

class MyClass {
    // constructor and various methods

    vector<Struct1> classVec;
}; // end MyClass

That error points to the line where "classVec" is declared. I've tried some things like adding empty constructors to the structs, but that didn't change anything. Any pointers would be appreciated.


That's the only error I'm getting:

error: multiple types in one declaration

I just realized though that the error is on the ending bracket of "MyClass", not the declaration of "classVec". I'm using g++ to compile.

Dang it, I'm an idiot. I didn't have a semicolon at the end of my second struct declaration. Yeah, that error makes sense to me now. Sorry for taking up your time, and thanks for the quick reply.

Now if I can figure out how to close this thread, both of my problems will be solved...

This question has already been answered. Start a new discussion instead.