okay so I have to create a class and use it in a program. I got all my normal er
ID: 441385 • Letter: O
Question
okay so I have to create a class and use it in a program. I got all my normal errors corrected, but now the compiler keeps saying "undefined refernce to" all of my class functions and my constructor. correct me if I'm wrong, but I did a little reading and it seems to be because of the way I link the files together. I have a header file(.h) that declares the class and its members, a file(.cpp) that defines all the class fuctions and members which #include the header(.h), and I have a main file that uses the class (all it #include is the header(.h)). (all of cource include IOstream. any ideas on what is happening here and or how to fix it.Explanation / Answer
lets say your class name is x. Then x.cpp and x.h is their respective information. You would only need to include x.h in main. The compiler would find x.cpp without your help. Just make sure that they( the .h and .cpp file) are in the same directory
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.