编译错误"String does not name a type"
Compilation Error "String does not name a type"
尽管程序中有"使用命名空间 std;",但我还是收到错误"字符串不命名类型"。
#ifndef SHAPE_H
#define SHAPE_H
using namespace std;
class Shape
{
public:
Shape();
virtual ~Shape();
string getShapeName();
void setShapeName(string shapeName);
virtual float calculateArea() = 0; //Calculates area of the shape
protected:
const float PI = 3.14159265;
private:
string m_ShapeName;
};
#endif // SHAPE_H_INCLUDED
您缺少<string>
标头:
#include <string>
相关文章:
- 将系数存储在头文件的数组中("does not name a type"错误)
- 将成员函数作为构造函数参数调用时出错 "Variable is not a type name"
- C++初学者:为什么我的编译器根据我的循环返回"name not found"?
- 当初始值设定项是基类名时'initializer does not name a non-static data member or base class'错误
- 如何解决"'mutex' in namespace 'std' does not name a type"?
- 在 C++ 中使用命名空间时出现"does not name a type"错误
- 已声明时"Does not name a type"错误
- 嵌套类"does not name a type"
- 为什么当我的代码超出函数范围时,"does not name a type"出现编译器错误?
- 巴泽尔中的错误"name 'new_local_repository' is not defined"
- 无法分隔标头类。我得到"does not name a type"
- 修复第三方代码:"error: ‘enable_if’ in namespace ‘std’ does not name a template type"
- 在 c++ 中,如果包含标头,为什么我会收到'does not a name of type'错误?
- 什么原因导致我的"‘FatalError’ in namespace ‘Foam’ does not name a type"错误?
- 编译错误"String does not name a type"
- 在模板化类中使用嵌套嵌套类时的'dependent name is not a type'
- 如何修复" 'Function' does not name a type "?[阿杜伊诺]
- 类定义内部"error: 'a' does not name a type"
- "does not name a type" .但它确实如此
- 不知道为什么我会得到"error: does not name a type "