It seems that the errors have not disappeared. Errors below. I looked at Google and still can not understand. It doesn't look like I'm new to Cpp, but haven't cheated on it for a while.
It is strange that he worked with g ++ on Windows ...
Errors:
- [see @ fed0r! --- ** __ *] $ g ++ main.cpp
- /tmp/ccJL2ZHE.o: In the `main 'function:
- main.cpp :(. text + 0x11): undefined link to `Help :: Help () '
- main.cpp :(. text + 0x1d): undefined link to `Help :: sayName () '
- main.cpp :(. text + 0x2e): undefined link to `Help :: ~ Help () '
- main.cpp :(. text + 0x46): undefined link to `Help :: ~ Help () '
- collect2: ld returned 1 exit status
main.cpp
#include <iostream> #include "Help.h" using namespace std; int main () { Help h; h.sayName(); // *** // *** // *** return 0; }
Help.h
#ifndef HELP_H #define HELP_H class Help { public: Help(); ~Help(); void sayName(); protected: private: }; #endif
Help.cpp
#include <iostream> #include "Help.h" using namespace std; Help::Help() { // Constructor } Help::~Help() { // Destructor } void Help::sayName() { cout << " ***************" << endl; cout << " ************************************" << endl; cout << " ************" << endl; cout << " *********************" << endl; }
Zeveso
source share