我是新来的C++,我通常可以挑选错误并找出错误,但我很难过。编译错误:不会命名一个类型
我得到一个错误说 “行| 10 |错误:在课堂上 '我的' 没有指定类型 '字符串'”
这里是mine.h:
#ifndef MINE_H
#define MINE_H
#include <iostream>
#include <string>
using namespace std;
class mine
{
public:
mine();
string getName();
};
#endif // MINE_H
这里是mine.cpp:
#include "mine.h"
#include <iostream>
#include <string>
using namespace std;
mine::mine()
{
//ctor
}
mine::string getName()
{
}
请不要使用'使用namespace'。 – GManNickG
而**从不**(ab)在头文件中使用'namespace std'! –