I'm trying to call a class in C++ but when i try to link i get the error :
kernel.cpp:(.text+0xe): undefined reference to 'Engine::Engine()'
kernel.cpp:(.text+01d): undefined reference to 'Engine::Test()'
Here is my code :
kernel.cpp
Code: Select all
#include "includes/Engine.h"
extern "C" void _main(struct multiboot_data* mbd, unsigned int magic);
void _main( struct multiboot_data* mbd, unsigned int magic )
{
Moteur m;
m.Test();
for(;;){}
}
Code: Select all
class Engine{
Engine::Engine(){
}
void Engine::Test(){
unsigned char *videoram = (unsigned char *) 0xb8077;
videoram[0] = 65;
videoram[1] = 0x07;
}
};
Code: Select all
class Moteur{
public:
Moteur();
void Test();
};
My make file execute like this :
i586-elf-g++ -c Moteur.cpp -nostdlib -nostartfiles -nodefaultlibs
i586-elf-g++ -c kernel.cpp -nostdlib -nostartfiles -nodefaultlibs
i586-elf-ld -T linker.ld -o kernel.bin loader.o Moteur.o kernel.o
But the last line returns the error.
Do you have any idea what i'm doing wrong ?
Thank you very much