C++ OS Programming
C++ OS Programming
Do you have a knowledge of OS programming in C++(under Windows)?? Which compilers do you use and which commands do you use for compile. Please, place here a link to download them. thx
PS: Please excuse my formulation, because i am czechian.
PS: Please excuse my formulation, because i am czechian.
Re: C++ OS Programming
I'm writing my OS in C++ in Microsoft Visual Studio 2005. (With FASM for the bootloader and protected-mode-entry stub) Check out "Visual C" on the wiki which details some of the issues I faced.
> PS: Please excuse my formulation, because i am czechian.
Cool! I am half-Czech... but unfortunately all I know of the language are the numbers 1-10, "good day", and "beer".
Mike
> PS: Please excuse my formulation, because i am czechian.
Cool! I am half-Czech... but unfortunately all I know of the language are the numbers 1-10, "good day", and "beer".
Mike
Which compiler
Which compilers and linkers do you use? If you use DJGPP please tell me what version.
...
4 Daedalus: Which commands do you use to compile the kernel of your OS?? I am using:
What i do wrong?
And cmd.exe gave back: Loader.o: File not recognized: File format not recognized@ECHO OFF
echo Kompiluji kernel...
c:\dev-cpp\bin\gcc -w -nostdlib -fno-builtin -ffreestanding -c -o kernel32.o kernel32.cpp
echo Kompiluji loader...
c:\compiler\nasm -f aout Loader.asm -o Loader.o
echo Linkuji...
c:\dev-cpp\bin\ld -o Kernel.bin Loader.o Kernel32.o
echo Proces dokoncen...
pause
What i do wrong?
Try this:
I am full Slovak, full Czech, "sort of a English'er" and "Ich spreche auch Deutsch, bitte !"
Slovensko pozdravuje Česko !
inflater
Code: Select all
echo Kompilujem loader...
c:\compiler\nasm -f bin Loader.asm -o Loader.o
echo Linkujem...
c:\dev-cpp\bin\ld -oformat BINARY -o Kernel.bin Loader.o Kernel32.o
Slovensko pozdravuje Česko !
inflater
eh
Now, it throw
Česko zdraví Slovensko!
Kompiluji kernel...
Kompiluji loader...
Loader.asm:6: error: binary output format does not support external references
Linkuji...
c:\dev-cpp\bin\ld: target BINARY not found
Proces dokoncen...
Pokračujte stisknutím libovolné klávesy...
Česko zdraví Slovensko!
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Uner windows you have three standard choices: GCC (cross-compiler, perhaps) MSVC and Watcom
I personally use the GCC cross-compiler, but you should check the wiki on how to use each of them, since the compilers, linkers and assemblers are generally not interoperable by default.
On another note, nasm generates binary output in this construction, not object files.
you should use
change "elf" with a different format to change the output. you may want to try "coff" if you use something else than gnu ld
(try "nasm -hf" to see what nasm can give you)
Something similar goes for the ld, where the parameter should probably read "--otarget binary", case sensitive.
I personally use the GCC cross-compiler, but you should check the wiki on how to use each of them, since the compilers, linkers and assemblers are generally not interoperable by default.
On another note, nasm generates binary output in this construction, not object files.
you should use
Code: Select all
nasm -f elf -o loader.o loader.asm
(try "nasm -hf" to see what nasm can give you)
Something similar goes for the ld, where the parameter should probably read "--otarget binary", case sensitive.
errr
In linking procces is something wrong:
Loader.o is succesfully compiled and linked, but in Kernel32.o is bug...
I use "nasm -f elf Loader.asm -o Loader.o".Kompiluji kernel...
Kompiluji loader...
Linkuji...
Kernel32.o(.text+0xd):kernel32.cpp: undefined reference to `std::string::size()
const'
Kernel32.o(.text+0x60):kernel32.cpp: undefined reference to `std::string::operat
or[](unsigned int) const'
Kernel32.o(.text+0x9f):kernel32.cpp: undefined reference to `std::string::operat
or[](unsigned int) const'
Kernel32.o(.text+0xce):kernel32.cpp: undefined reference to `std::string::operat
or[](unsigned int) const'
Kernel32.o(.text+0x121):kernel32.cpp: undefined reference to `_alloca'
Kernel32.o(.text+0x126):kernel32.cpp: undefined reference to `__main'
Kernel32.o(.text+0x135):kernel32.cpp: undefined reference to `std::cout'
Kernel32.o(.text+0x13a):kernel32.cpp: undefined reference to `std::basic_ostream
<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::
basic_ostream<char, std::char_traits<char> >&, char const*)'
Kernel32.o(.text+0x163):kernel32.cpp: undefined reference to `std::ios_base::Ini
t::Init()'
Kernel32.o(.text+0x17e):kernel32.cpp: undefined reference to `std::ios_base::Ini
t::~Init()'
Proces dokoncen...
Pokračujte stisknutím libovolné klávesy...
Loader.o is succesfully compiled and linked, but in Kernel32.o is bug...
Last edited by Cmaranec on Sun Oct 22, 2006 8:34 am, edited 1 time in total.
linker script
I have a linker script from wiki. When i used the old classic linker script, it wrote "PE operations on non PE file". I use script from wiki.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact: