Hi,
I've encountered the following problem:
Shared library code is:
foo.h:
class Foo
{
public:
bool Nothing(void);
};
foo.cpp:
#include "foo.h"
inline bool Foo::Nothing(void)
{
return true;
}
I create the library using this command line: g++ foo.cpp -shared -o
libfoo.so
Executable code is:
main.cpp:
#include <iostream>
#include "foo.h"
using namespace std;
int main(void)
{
Foo f;
cout << f.Nothing() << endl;
return 0;
}
I create the executable using this command line: g++ main.cpp -o main
-L. -Wl,-rpath,. -lfoo
And I get:
undefined reference to 'Foo::Nothing()'
What am I doing wrong?
How can I expose an inline function WITHOUT implementing it in the
header file?
GCC version: 4.1.2 20080704 (Red Hat 4.1.2-44)
Target: i386-redhat-linux
Thanks!