Undefined reference on linked in assembly function [closed]-Collection of common programming errors
I am trying to compile my kernel, but at link time I get:
DescriptorTables.cpp:(.text+0x123): undefined reference to `gdt_flush(unsigned int)’
gdt_flush
is a function in an external assembler file that gets linked with DescriptorTables.cpp. This is unusual because it is declared as global in asm, and external in C++ (extern
).
Could this be possible because g++ is looking for a function that takes an argument, and gdt_flush
is looking at the eax
register for its parameter?
Update: I figured it out, g++ was calling it as a c++ style call, not a c (plain) call. I just had to put extern "C" ...
in front of the function to make it callable.
Originally posted 2013-11-09 23:11:51.