/* test.c */
void func1()
{
}
int main()
{
func1();
}
Hello, I am making kernel code using C. But I tested above code to know how to build C kernel code. Below command is what I gave to prompt. I am using MinGW on Windows 8.1.
gcc -c -m32 test.c
ld -o test -Ttext 0x00 -e _main test.o
But this error was occurred from ld.
test.o:test.c:(.text+0x7): undefined reference to `__main'
So, I tried different way. add -nostdlib and --freestanding option to gcc. But the result was same. Is __main function in CRT0 ? What should I do to solve this problem.. ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…