简体   繁体   中英

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.

I'm getting an error saying "line|10|error: 'string' in class 'mine' does not name a type"

Here is 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:

#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()
{

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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