Code: Select all
undefined reference to basic_ifstream
Code: Select all
G++
No more linker errors.
Now there is a new problem: When I compile my C++ code with the library alone (without any use of the library), it works. But when I start to use it, and recompile and run, I get my Page Fault Interrupt called. I don't understand this one bit. Is there not enough free disk space? Sometimes, running
Code: Select all
make buildimg
Code: Select all
Disk Full
Here is my Kernel Makefile:
Code: Select all
ARCH = x86_64
TARGET = ../setup/kernel.elf
SRCS = c/kernel.cpp
BUILDDIR = disk
OSNAME = BirdOS
OBJDIR := build
MAINDIR = ../setup
SRCDIR := c
CC = gcc
LD = g++
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SRC = $(call rwildcard,$(SRCDIR),*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRC))
all: $(OBJS) link
# UEFI wastes lots and lots of memory. Link our "kernel" at an address (32M) which isn't used by UEFI
$(OBJDIR)/interrupts/interrupts.o: $(SRCDIR)/interrupts/interrupts.cpp
@ mkdir -p $(@D)
$(CC) -mno-red-zone -mgeneral-regs-only -ffreestanding -c $^ -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@ mkdir -p $(@D)
$(CC) -ffreestanding -fshort-wchar -mno-red-zone -c $^ -o $@
assem:
@ mkdir -p build/GDT
nasm c/GDT/GDTASM.asm -f elf64 -o build/GDT/GDTASM.o
link:
g++ -Wl,-estart -Wl,-z -Wl,max-page-size=0x1000 -Wl,-Ttext=0x01000000 -Wl,-Bsymbolic -static -o $(TARGET) $(OBJS) build/GDT/GDTASM.o
clean:
rm build/*.o $(TARGET) 2>/dev/null || true
buildimg:
dd if=/dev/zero of=$(BUILDDIR)/$(OSNAME).img bs=512 count=93750
mformat -i $(BUILDDIR)/$(OSNAME).img -f 2880 ::
mmd -i $(BUILDDIR)/$(OSNAME).img ::/EFI
mmd -i $(BUILDDIR)/$(OSNAME).img ::/EFI/BOOT
mcopy -i $(BUILDDIR)/$(OSNAME).img $(BUILDDIR)/startup.nsh ::
mcopy -i $(BUILDDIR)/$(OSNAME).img $(BUILDDIR)/main.efi ::
mcopy -i $(BUILDDIR)/$(OSNAME).img $(TARGET) ::
Bootloader Makefile:
Code: Select all
TARGET = ../src/disk/main.efi
SRCS = main.c
EXTRA = kernel.elf
#USE_GCC=1
include uefi/Makefile
kernel.elf:
@make -C kernel all USE_GCC=$(USE_GCC)
Code: Select all
#include "stream/ostream.h"
#include <iostream>
#include <fstream>
bootparam_t *bootp;
using namespace std;
extern "C" void start(bootparam_t *bootpar)
{
bootp = bootpar;
LoadKernel();
ofstream myFile("hello.txt");
myFile.open("h");
myFile << "Hello, world!";
myFile.close();
while(true) {
ActivateCursorBlinker(KeyboardPositionX, KeyboardPositionY);
};
}
Does anybody know why it is doing this and how to resolve it?
Thanks for your help!