#include <stdlib.h>
class Lol
{
public:
static int Init()
{
Lol::system = system;
return (1);
}
static int (*system)(char*);
};
int main()
{
Lol::Init();
Lol::system("/bin/echo lol");
return (0);
}
$ g++ t.cpp
t.cpp: In function ‘int main()’:
t.cpp:18: warning: deprecated conversion from string constant to ‘char*’
/tmp/ccMzk92n.o: In function `main':
t.cpp:(.text+0x18): undefined reference to `Lol::system'
/tmp/ccMzk92n.o: In function `Lol::Init()':
t.cpp:(.text._ZN3Lol4InitEv[Lol::Init()]+0x4): undefined reference to `Lol::system'
t.cpp:(.text._ZN3Lol4InitEv[Lol::Init()]+0x9): undefined reference to `Lol::system'
collect2: ld returned 1 exit status