OS-Reference icon indicating copy to clipboard operation
OS-Reference copied to clipboard

Fix GCC not compiling .c files, but .cpp

Open HTTPHeader opened this issue 6 months ago • 1 comments

I think I fixed it

Problem: GCC won't compile the kernel unless its code is placed in a .cpp file

From OSDev Wiki: "Writing a kernel in C++ is easy. Note that not all features from the language is available. For instance, exception support requires special runtime support and so does memory allocation. To write a kernel in C++, simply adopt code above: Add an extern "C" declaration to the main method."

Solution: Remove extern "C" from void main in kernel.cpp, and rename the file to kernel.c

HTTPHeader avatar Aug 23 '24 16:08 HTTPHeader