Hello everyone I keep getting this array must not exceed error but all I trying to create is a 20 x 20 array of objects. It does the same with objects and templates.
The reason I am using an array and not a vector is because I need a constant 20 x 20 container for my game board. And from what i think I know vectors re-size them self's every time some thing is removed or added. Please let me know where I went wrong Thank you very much.
Edit: Why can I put this line: 'Organism temp[20][20];'
in main and have no issues.
:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\gameboard.h(20): error C2148: total size of array must not exceed 0x7fffffff bytes
1> d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\organsim.h(32) : see reference to classtemplate instantiation 'GameBoard<T>' being compiled
1> with
[
1> T=Organism
1> ]
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\gameboard.h(20): error C2079: 'GameBoard<T>::_gameBoard' uses undefined class'Organism'
1> with
1> [
1> T=Organism
1> ]
1> Exercise_03.cpp
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.h(9): error C2504: 'Organism' : base class undefined
1> Ant.cpp
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.h(9): error C2504: 'Organism' : base class undefined
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.cpp(10): error C2614: 'Ant' : illegal member initialization: 'Organism' is not a base or member
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.cpp(19): error C2653: 'Organism' : is not a class or namespace name
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.cpp(24): error C2653: 'Organism' : is not a class or namespace name
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.cpp(25): error C2653: 'Organism' : is not a class or namespace name
1>d:\users\adam\skydrive\c++_projects\chapter_15\exercise_03\exercise_03\ant.cpp(32): error C2065: '_points' : undeclared identifier
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
- GameBoard has an array of T's
- Organism has a gameboard of Organisms.
- This effectively means that each Organism has an an array of organisms.
- Which means that each of the organisms in that array has its own array
- and each organism in that array has yet another array
- etc etc
- as a result organisms are infinitely large and cannot be instantiated.
This is a design problem. Each organism should not have their own game board, but should have a pointer/reference to a game board owned by some other part of the program.