我是新來的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'! –