c++ - ’Population’ has not been declared

【字号: 日期:2023-04-04浏览:38作者:雯心

问题描述

我有两个类Population和Group,因为要写一个Group的成员函数

void initialize(Population<T> &p, const int id);

但我已经加载了Population的头文件,IDE却提示我Population’ has not been declared,请问这是什么情况??

c++ - ’Population’ has not been declared

c++ - ’Population’ has not been declared

这是Population的内容和位置

c++ - ’Population’ has not been declared

c++ - ’Population’ has not been declared

问题解答

回答1:

include路径都是从当前路径开始的. 你显示的图. 有些不太懂. 但是根据图像信息. 我写了一下, 你试一下吧.c++ - ’Population’ has not been declaredc++ - ’Population’ has not been declared

回答2:

问题已经解决了,因为Population.h中已经包含了Group文件。所以在Group类的上面声明一下Population类就可以使用了。。

相关文章: