I wasn't really sure what to put as the title, but I'll attempt to explain my problem as best as I can.
I'm attempting to follow James Molloy's kernel development tutorials, using OS X as my development operating system. I successfully got the developer tools installed and am able to compile C programs, as well as use NASM, but now my problem lies here:
main.c 4:5 error: first parameter of 'main' (argument count) must be of type 'int'
Here's the code (yes, it's copied and pasted and from the first tutorial):
// main.c -- Defines the C-code kernel entry point, calls initialisation routines.
// Made for JamesM's tutorials <www.jamesmolloy.co.uk>
int main(struct multiboot *mboot_ptr)
{
// All our initialisation calls will go in here.
return 0xDEADBABA;
}
Unfortunately, after a bit of googling (but perhaps I'm just googling the wrong thing), I haven't found a solution. The makefile (also copied and pasted) is this:
Makefile for JamesM's kernel tutorials.
The C and C++ rules are already setup by default.
The only one that needs changing is the assembler
rule, as we use nasm instead of GNU as.
SOURCES=boot.o main.o
CFLAGS=-Wall -fstrength-reduce -nostdlib -fomit-frame-pointer -fno-builtin -fno-stack-protector
LDFLAGS=-Tlink.ld
ASFLAGS=-felf
all: $(SOURCES) link
clean:
-rm *.o kernel
link:
ld $(LDFLAGS) -o kernel $(SOURCES)
.s.o:
nasm $(ASFLAGS) $<
If someone could kindly point me in the right direction, it would be much appreciated.
I have a feeling it might be something that I'm misunderstanding with Clang, but I really don't know if so. Also, if using OS X as a kernel developing platform is not advised (I'd really like to use it) then could you please point me in the right direction to a suitable platform for OS development?
I found this page called "James Molloy's Tutorial Known Bugs" http://wiki.osdev.org/James_Molloy%27s_Tutorial_Known_Bugs and one remark is: This isn't a regular main
function: The name main
is actually a special case in C and it would be inadvisable to call it that. You should call it something like kernel_main
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.