-1
この問題が私のIDEにあるのかどうか分かりませんが、Code :: BlocksとVisual Studioの両方をプロジェクトで試してみました。"Class :: method"への未定義の参照C++?
私のメインのファイル:
#include <iostream>
#include "Hello.h"
using namespace std;
int main()
{
Hello firstMan;
firstMan.greeting();
firstMan.goodbye();
firstMan.goodbye();
}
マイHello.h:
#ifndef HELLO_H_INCLUDED
#define HELLO_H_INCLUDED
class Hello
{
public:
void greeting();
void goodbye();
};
#endif // HELLO_H_INCLUDED
そして、私のクラスファイルHi.cpp:
#include <iostream>
#include "Hello.h"
using namespace std;
void Hello::greeting()
{
cout << "Hello" << endl;
}
void Hello::goodbye()
{
cout << "Bye" << endl;
}
私はちょうどので、C++を開始しましたこれが単純なエラーであれば、私は謝ります。