| | |
Issue creating a vector of a struct in C++
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2005
Posts: 9
Reputation:
Solved Threads: 0
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:
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.
Thanks!
Here's the form my code's in:
C++ Syntax (Toggle Plain Text)
#include <vector> using namespace std; struct Struct2 { int value1; int value2; }; // end Struct2 struct Struct1 { int value; vector<Struct2> vec; }; // end Struct1 class MyClass { public: // constructor and various methods private: vector<Struct1> classVec; }; // end MyClass
Thanks!
![]() |
Similar Threads
- Javascript, Form fields validation and submit (JavaScript / DHTML / AJAX)
- HELP me as soon as possible ..! (C++)
- 6 Line class -> Me pounding head into wall (C)
- Disappearing Drive in Win XP (Storage)
Other Threads in the C++ Forum
- Previous Thread: how to set the window position of my console applicaton ?
- Next Thread: Simple array question
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






