I am trying to implement a finite element code for my research. I need to create a map that associates materials with their names so that I can access them by name. From the header file of the main class, I define the following:
/// Friend class definition for the materials
friend class Material;
/// Class definition for the materials
class Material;
/// Creates a dictionary of elementsets vs material names
std::map<std::string,std::string> _material_assignment;
/// Container to hold the material names of all the materials
std::map<std::string,Material> _materials;
The implementation of the main class compiles. However, when the makefile reaches the main file, I get the following error
Error: 'std::pair<_T1, _T2>::second' has incomplete type
_T2 second; /// @c second is a copy of the second object
^
In file included from src/main.C:5:0:
src/diff_code.h:228:9: error: forward declaration of 'class DiffCode::Material'
class Material;
How do I get around this. All the other files of my code which all include the header file for the important code class are compiling.
Thanks!