it's my first post in this forum:i m a begginner in the world od devlopment of os i m actually leaning how can i make my kernel with C++.
i have three file: loader.asm, kernel.cpp and video.cpp with his header video.h
there is my code:
loader.asm:
Code: Select all
[BITS 32]
[global start]
[extern _main]
start:
call _main
cli
hlt
it make the loader.o
and with these two commands:
*gcc -c video.cpp -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
*gcc -c kernel.cpp -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
i get my file *.o this is there code:
kernel.cpp
Code: Select all
#include "video.h"
int main(void)
{
Video v;
v.write("bonjour cher utilisateur!");
}
Code: Select all
#include "video.h"
Video::Video()
{
pos = 0;
off = 0;
videomem = (unsigned short*) 0xb8000;
}
Video::~Video()
{
}
void Video::clear()
{
unsigned int i;
for(i=0;i<(80*25);i++)
{
videomem[i] = (unsigned char) "" | 0x700;
}
pos=0;off=0;
}
void Video::write(char *cp)
{
char *str = cp, *ch;
for(ch = str;*ch;ch++)
{
put(*ch);
}
}
void Video::put(char c)
{
if(pos>=80)
{
pos = 0;
off += 80;
}
if(off>=(80*25))
{
clear();
}
videomem[off + pos] = (unsigned char)c|0x0700;
pos++;
}
he says: ld:loader.o: file not recognized
thanks for help gyus...