milkcool wrote:
What am I doing wrong?
- Following a tutorial
- Trying to include standard C libraries
- Not switching to 64-bit mode
Most tutorials focused on or around OS development have mistakes. Usually the author is a beginner like you, documenting their process as they go, including their mistakes that they haven't noticed yet. Most tutorial authors give up before they reach the point where they could go back and correct their mistakes.
Standard C libraries depend on an OS. You're trying to include standard C libraries designed to run on Linux. Your OS is not compatible with Linux (for now), so the Linux C libraries won't work. You
can use freestanding C headers; those don't depend on an OS.
Multiboot says the CPU starts in 32-bit mode. You have to switch the CPU into 64-bit mode before you can run 64-bit code. Switching to 64-bit mode is not exactly simple; you need to set up a GDT and some page tables, and mess with a handful of control registers. If you really want to write a 64-bit OS, you might have an easier time if you use a bootloader that can handle switching to 64-bit mode (such as Limine). You'll still need to set up a GDT and some page tables eventually, but then you can put it off until you're more familiar with x86.