I am following JamesM's tutorial on rolling your own kernel, and when I am compiling the kernel (just a basic one), I get the following errors:
main.cpp:8: error: first argument of ‘int main(multiboot*)’ should be ‘int’
main.cpp:8: error: ‘int main(multiboot*)’ takes only zero or two arguments
main.cpp: In function ‘int main(multiboot*)’:
main.cpp:13: warning: deprecated conversion from string constant to ‘char*’
main.cpp:15: warning: deprecated conversion from string constant to ‘char*’
main.cpp:17: warning: deprecated conversion from string constant to ‘char*’
main.cpp:20: warning: deprecated conversion from string constant to ‘char*’
main.cpp:24: warning: deprecated conversion from string constant to ‘char*’
main.cpp:28: warning: deprecated conversion from string constant to ‘char*’
I am using gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12). Anyone have any ideas?
Having Compilation Issues with GCC
- AndrewAPrice
- Member
- Posts: 2306
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: Having Compilation Issues with GCC
What compile switches are you using? Also try kmain instead of main if all else fails.
My OS is Perception.
Re: Having Compilation Issues with GCC
Try replacing char* with const char*, to signal the compiler that you don't intend to write to the string constants. As for the errors, I don't have any ideas.sparticvs wrote:main.cpp:13: warning: deprecated conversion from string constant to ‘char*’
main.cpp:15: warning: deprecated conversion from string constant to ‘char*’
main.cpp:17: warning: deprecated conversion from string constant to ‘char*’
main.cpp:20: warning: deprecated conversion from string constant to ‘char*’
main.cpp:24: warning: deprecated conversion from string constant to ‘char*’
main.cpp:28: warning: deprecated conversion from string constant to ‘char*’
Re: Having Compilation Issues with GCC
complete reply:
for the error: gcc expects a main of form in main(int argc, char **argv). so, replace main with kmain everywhere.
for thee warnings: use constant char* instead of char* when it's about a string(things like puts, printf, etc).
for the error: gcc expects a main of form in main(int argc, char **argv). so, replace main with kmain everywhere.
for thee warnings: use constant char* instead of char* when it's about a string(things like puts, printf, etc).
Re: Having Compilation Issues with GCC
Wonderful idea, thanks...honestly don't know why I didn't think of that..