#include <string> in a header the defines some structs. ERROR: string does not define a type
#ifndef STRCUTS_H
#define STRCUTS_H
#include <string>
struct menuEntry
{
string itemID; //'string' 开发者_Go百科does not name a type
string itemName; //'string' does not name a type
};
#endif
I get the same error when I put #include < string> above the header guard. Come to think of it, I've had weird trouble with putting struct definitions in headers before. Must be something I'm not getting.
You need to change string
to std::string
, i.e.
#ifndef STRCUTS_H
#define STRCUTS_H
#include <string>
struct menuEntry
{
std::string itemID;
std::string itemName;
};
#endif
精彩评论