Plexo
0
Hallo!
Ich kriege folgende Fehlermeldung beim Linken eines Testprogramms, welches eine Testklasse nutzt.
Und hier sind noch die Quellcodes.
Ich hoffe, dass mir jemand helfen kann.
Danke schonmal!
Gruß
Ich kriege folgende Fehlermeldung beim Linken eines Testprogramms, welches eine Testklasse nutzt.
Code:
# g++ -o FooMain FooMain.cpp
/tmp/ccSYd552.o: In function `main':
FooMain.cpp:(.text+0x8b): undefined reference to `Foo::Foo()'
FooMain.cpp:(.text+0x96): undefined reference to `Foo::get()'
FooMain.cpp:(.text+0xc9): undefined reference to `Foo::set(int)'
FooMain.cpp:(.text+0xd4): undefined reference to `Foo::get()'
FooMain.cpp:(.text+0x104): undefined reference to `Foo::~Foo()'
FooMain.cpp:(.text+0x11a): undefined reference to `Foo::~Foo()'
collect2: ld gab 1 als Ende-Status zurück
Und hier sind noch die Quellcodes.
Code:
// FooMain.cpp
#include <iostream>
using namespace std;
#include "Foo.hpp"
int main()
{
Foo f;
cout << f.get() << endl;
f.set( 5 );
cout << f.get() << endl;
return 0;
}
Code:
// Foo.hpp
class Foo
{
private:
int foo;
public:
Foo();
~Foo();
void set( int );
int get();
};
Code:
// Foo.cpp
#include "Foo.hpp"
Foo::Foo()
{
foo = 1;
}
Foo::~Foo()
{
}
int Foo::get()
{
return foo;
}
void Foo::set( int i )
{
foo = i;
}
Ich hoffe, dass mir jemand helfen kann.
Danke schonmal!
Gruß