c++ - Problem with "not declared in this scope" error -


I have found:

Error not declared in this area

Can anyone explain why this code is the reason?

quiz.h

  #ifndef QUIZ_H_ # Define QUIZ_H_ #include "quiz.cpp" // I removed this line // and deleted the quote quote (int i ) Written; Class A {Private: integer player; Public: A (Intuitplayer); // written here = 0 ~ A (); Zero foo (); }; #endif / * QUIZ_H_ * /  

Quiz CPP

  #include "quiz.h" #include & lt; Iostream & gt; Using std :: cout; Using the Std :: endl; A: A (int plateer = 0) {// deleted = 0 player = initPlayer; } A: ~ A () {} Zero A: Fu () {cout & lt; & Lt; Player; }  

main function

  #include "quiz.h" int main () {quiz (7); Return 0; }  

quiz function

  #include "quiz.h" zero quiz (int i) {a a1 (i); A1.foo (); }  

After my modifications I have several definitions of an error quiz (en)

You should not include the .cpp file in the header. Remove:

  #include "quiz.cpp"  

Additionally, the default value in:

  A :: AE (at leastplayer = 0) { 

) should be in the header file instead.

And edit your question All your files, we will tell you how to compile and link them.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -