Why do i get this message from fedora 7's premade gcc 4.1.2 (but not from my other compiler, a homemade 3.3.6):
warning: incompatible implicit declaration of built-in function ‘exit’
Printable View
Why do i get this message from fedora 7's premade gcc 4.1.2 (but not from my other compiler, a homemade 3.3.6):
warning: incompatible implicit declaration of built-in function ‘exit’
Maybe post some relevant code?
Code:int main () {
exit(0);
}
test.c: In function ‘main’:
test.c:2: warning: incompatible implicit declaration of built-in function ‘exit’
No more, no less...
exit() requires <stdlib.h> doesn't it? That's what "man 3 exit" says.
exit() requires <stdlib.h> doesn't it? That's what "man 3 exit" says.
Correct you are...I guess the fact that "exit()" still works without stdlib.h had me confused.
Thanks!
It "works" because you can still call any function without a prototype, the linker sorts that bit out. However, now the compiler is unable to tell whether the function is correctly used or not. It seems like 4.1.2 enables some more warnings by default, which gives you that warning. [Or perhaps exit() has been changed from a standard function to a builtin function - builtin functions are not normally extracted from a library, but instead, the compiler in itself knows how to produce the code for that function - many simple functions are builtin.]
--
Mats