情況:我試圖在Nodes類中創建一系列方法,所有這些方法都將使用由playerName(string)和next(listnode)組成的結構「listnode」 。我在頭文件中創建了結構,因爲我也將在主類中使用該結構。缺少類型說明符 - int假定C4430錯誤
錯誤:當我編譯,我得到一個不尋常的錯誤,它的一個錯誤「C4430:缺少類型說明符 - 假定爲int。注意:C++不支持默認INT」我得到這個錯誤像8
#ifndef STRUCTS_H
#define STRUCTS_H
#include <Windows.h>
#include <string>
typedef struct
{
string playerName;
listnode * next;
} listnode;
#endif
如果是C++,則不需要typedef。 –
正確 - 我不確定OP是否要使用C/C++兼容的頭文件,但是我想不是因爲他使用了''。 –