Mat*_*son 4 c++ struct types header include
#ifndef STRCUTS_H
#define STRCUTS_H
#include <string>
struct menuEntry
{
string itemID; //'string' does not name a type
string itemName; //'string' does not name a type
};
#endif
Run Code Online (Sandbox Code Playgroud)
当我把#include <string>放在标题保护之上时,我得到了同样的错误.想想看,我之前在结构中定义结构定义时遇到了奇怪的麻烦.必须是我没有得到的东西.
你需要换string到std::string,即
#ifndef STRCUTS_H
#define STRCUTS_H
#include <string>
struct menuEntry
{
std::string itemID;
std::string itemName;
};
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5187 次 |
| 最近记录: |