Geany で C++ コードをコンパイルしようとしています。
コンパイル コマンド: g++ -Wall -c "%f"
ビルド コマンド: g++ -Wall -o "%e" "%f"
main.cpp:
#include <iostream>
#include "Person.hpp"
int main()
{
Person p1(16);
std::cout << p1.getAge();
return 0;
}
人.hpp
class Person
{
public:
Person(int a);
void setAge(int);
int getAge() const;
private:
int age;
};
inline int Person::getAge() const
{
return age;
}
人.cpp
#include "Person.hpp"
Person::Person(int a)
{
age = a;
}
void Person::setAge(int a)
{
age = a;
}
エラー:
g++ -Wall -o "main" "main.cpp" (ディレクトリ内: /home/me/projects/Test) /tmp/ccxYmWkE.o: 関数
main': main.cpp:(.text+0x15): undefined reference to
Person::Person(int) で collect2: エラー: ld が 1 を返しました終了ステータス コンパイルに失敗しました。
Geany の前は、Code::Blocks だけを使用していましたが、すべて正常に機能していました。どうすれば修正できますか?