我受命为我的大学 CMSC 类(class)编写一个 Blackjack 项目。我已经制作了所有必需的源文件,但是有一个我无法弄清楚的错误。我正在使用带有 Makefile 的终端来编译我的程序。
当我编译我的程序时,我在终端中收到此错误以及其他警告(我不关心这些警告)。
In file included from Blackjack.h:19:0,
from Proj2.cpp:12:
Player.h:17:3: error: ‘Hand’ does not name a type
Hand hand;
^
In file included from Blackjack.h:19:0,
from Blackjack.cpp:1:
Player.h:17:3: error: ‘Hand’ does not name a type
Hand hand;
这是我在 Github 存储库中的源代码。
https://github.com/Terrablezach/Blackjack
谁能告诉我为什么“Hand”类没有命名类型?我已将它包含在需要包含它的头文件中,但我不明白为什么它不将其识别为一个类。
预先感谢您的帮助。
最佳答案
您还没有在 Player.h
中包含 Hand.h
,因此 Hand
的定义在那里不可用。
关于C++ - 类没有命名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22476689/