我正在尝试为我的研究实现有限元代码。我需要创建一个将材质与其名称相关联的地图,以便我可以按名称访问它们。从主类的头文件中,我定义了以下内容:
/// 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;
主类的实现编译。但是,当 makefile 到达主文件时,我收到以下错误
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;
我该如何解决这个问题。我的代码的所有其他文件都包含重要代码类的头文件正在编译。
谢谢!