int main()
{
printf("Hello world!\n");
return 0;
}
-------------- Build: Debug in DelMe ---------------
Compiling: main.c
/home/killerbot/Projects/DelMe/main.c: In function ‘main’:
/home/killerbot/Projects/DelMe/main.c:6: warning: implicit declaration of function ‘printf’
/home/killerbot/Projects/DelMe/main.c:6: warning: incompatible implicit declaration of built-in function ‘printf’
Linking console executable: bin/Debug/DelMe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 2 warnings
-------------- Build: Debug in DelMe ---------------
[ 50.0%] Compiling: main.c
C:\Projects\DelMe\main.c: In function `main':
C:\Projects\DelMe\main.c:5: warning: implicit declaration of function `printf'
[100.0%] Linking console executable: ..\Deliv\Debug\DelMe.exe
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 1 warnings
Build log saved as: C:\Projects\DelMe\DelMe_build_log.html
-------------- Build: Debug in DelMe ---------------
[ 50.0%] Compiling: main.c
C:\Projects\DelMe\main.c: In function `main':
C:\Projects\DelMe\main.c:5: error: implicit declaration of function `printf'
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
Build log saved as: C:\Projects\DelMe\DelMe_build_log.html
function call with no prototype will be assumed to take the arguments given on the first invocation and return an int result
int main()
{
printf("The return value of printf(\" Hello world\"); is %d!\n",printf("Hello world\n") );
return 0;
}
GCC 3.4.5 also gave a warning , see a reply of mine with log aboveNot sure which code you got a warning with, but the following doesn't even provoke a warning:
int main()
{
printf("Hello, world!\n");
return 0;
}
gcc -o test.exe test.c
The following ISO C89 functions are recognized as built-in functions unless `-fno-builtin' is specified: abs, cos, fabs, fprintf, fputs, labs, memcmp, memcpy, memset, printf, sin, sqrt, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncat, strncmp, strncpy, strpbrk, strrchr, strspn, and strstr. All of these functions have corresponding versions prefixed with __builtin_.