简体   繁体   English

编译器错误:未命名类型

[英]Compiler error: does not name a type

I'm new to c++ and I usually can pick through errors and figure out what's wrong but I'm stumped. 我是C ++的新手,通常可以找出错误并找出问题所在,但是我很困惑。

I'm getting an error saying "line|10|error: 'string' in class 'mine' does not name a type" 我收到一条错误消息,说“ line | 10 | error:类'mine'中的'string'没有命名类型”

Here is mine.h: 这是mine.h:

#ifndef MINE_H
#define MINE_H
#include <iostream>
#include <string>

using namespace std;

class mine
{

public:
mine();
string getName();

};

#endif // MINE_H

Here is mine.cpp: 这是mine.cpp:

#include "mine.h"
#include <iostream>
#include <string>

using namespace std;
mine::mine()
{
    //ctor
}

mine::string getName()
{

}
mine::string getName()
{

} 

Should have been 本来应该

string mine::getName()
{

} 

It should be: 它应该是:

string mine::getName()
{

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM