I recently started on the Bare Bones tutorial for C++ on Ubuntu.
Assembling loader.s with NASM went perfectly fine, while I get this error trying to assemble kmain.cpp:
twixthehero@mini12:~/os$ gcc -o kmain.o -c kmain.cpp
kmain.cpp:1:19: error: cstdint: No such file or directory
kmain.cpp: In function ‘void kmain()’:
kmain.cpp:5: error: expected unqualified-id before string constant
kmain.cpp:6: error: expected unqualified-id before string constant
kmain.cpp:8: error: ‘magic’ was not declared in this scope
kmain.cpp
Code: Select all
#include <cstdint>
extern "C" void kmain(void)
{
extern "C" uint32_t magic;
extern "C" void *mbd;
if (magic != 0x2BADB002)
{
/* Something went not according to specs. Print an error */
/* message and halt, but do *not* rely on the multiboot */
/* data structure. */
}
//char * boot_loader_name = (char *) ((long *)mbd)[16];
/* Print a letter to screen to see everything is working: */
unsigned char *videoram = (unsigned char *)0xb8000;
videoram[0] = 65; /* character 'A' */
videoram[1] = 0x07; /* light grey (7) on black (0). */
}