Yousif Dafalla
Yousif Dafalla

Reputation: 15

String does not name a type

I am using Net beans to create a banking application I have three files Client.h, Client.CPP and main.CPP

//Client.h
#ifndef CLIENT_H
#define CLIENT_H
using namespace std;
class Client {
public:
    Client();
    Client(const Client& orig);
    virtual ~Client();
private:
    string fname;
    string lname;

};

#endif /* CLIENT_H */

//Client.cpp
#include "Client.h"

Client::Client() {
}

Client::Client(const Client& orig) {
}

Client::~Client() {
}

When i compile my project i get the following error String does not name a type although i am using namespace std;

Upvotes: 0

Views: 2855

Answers (1)

GiantGeorge
GiantGeorge

Reputation: 21

#include <string> is needed.

std namespace is one thing, but in order to let the compile known the string name, you should tell it.

Upvotes: 1

Related Questions