1

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

}
2
  • 2
    Please don't use using namespace. Commented Nov 27, 2011 at 23:25
  • 1
    And never (ab)use namespace std in a header file! Commented Nov 27, 2011 at 23:25

2 Answers 2

7
mine::string getName()
{

} 

Should have been

string mine::getName()
{

} 
Sign up to request clarification or add additional context in comments.

Comments

3

It should be:

string mine::getName()
{

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.