I writing demo console game and received strange compile error in headers. And i code test-project for test it`s problem. (Question in down)
Classes use vector 2D matrix, which containe other class and in the end it`s loop on first class.
And this structure receive this errors:
- error C2065: 'Class1': undeclared identifier
- error C2923: 'std::vector': 'Class1' is not a valid template type argument for parameter '_Ty'
- error C2903: 'allocator': symbol is neither a class template nor a function template
- error C3203: 'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type
- error C3203: 'vector': unspecialized class template can't be used as a template argument for template parameter '_Ty', expected a real type
Header 1:
#pragma once
ifndef CLASS_ONE
define CLASS_ONE
include "Class2.h" include
using namespace std;
class Class1 { private: vector< vector > map;
public: Class1(int i1, int i2); };
Header 2
#pragma once
ifndef CLASS_TWO define CLASS_TWO
include "Class3.h" include
using namespace std;
class Class2 { private: vector< vector > testVector;
public: Class2(int y, int x); };
Header 3
#pragma once
ifndef CLASS_THREE define CLASS_THREE
include "class1.h" include
using namespace std;
class Class3 { private: vector< vector > testVector;
public: Class3(int i1, int i2); };
And question: what is the name of this problem and how solve it.
Aucun commentaire:
Enregistrer un commentaire