编译错误“字符串未命名类型”

时间:2017-05-27 16:03:41

标签: c++ compiler-errors

我收到错误“字符串没有命名类型”尽管有“using namespace 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

1 个答案:

答案 0 :(得分:1)

您缺少<string>标题:

#include <string>