unterminated #ifndef

Hello.
I have this problem when I want to compile dis particular class. It said unterminated #ifndef. I read somewhere this happened because no #endif was present. I did put mind but it still shows the same problem. Please help. Thanx you :D


#ifndef Player_h
#define Player_h

#include "Setting.cpp"
#include <fstream>
#include <iostream>

using namespace std;

class Player
{
public:
void getinfo(string&);
void displayinfo(string);
void storeinfo();


protected:
string player;
Setting setting;
};
#endif

You shouldn't include cpp files.
The problem may be in Stetting.cpp or some file included from there.
owh. its true that my Setting.cpp have problem. it about inline function. its say that this inline function used but never defined. i already declared in it setting.h. but still no effect. could you please help?
You should include Setting.h in Setting.cpp, not the other way round.

You have included Setting.cpp in the Setting.h file, which means that the preprocessor basically copies Setting.cpp into Setting.h at that location, verbatim. So you are calling this function before it is defined, since the call is above the definition. This may well be solved if you do as I suggest and include Setting.h in Setting.cpp and not the other way round.

As Bazzy said,
You shouldn't include cpp files


Hope this helps.
Last edited on
Topic archived. No new replies allowed.