les options de base pour la compilation :
typiquement pour un programme truc
gcc -Wall truc.c -o truc && strip truc
1 2 3 4 5 6
| #include <stdio.h>
int main(void) {
printf("hello, world\n");
return 0;
} |
ou plus drôle :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <stdlib.h>
#include <stdio.h>
#include <sys/errno.h>
#include <string.h>
int main(void) {
int success = fputs("Hello World!\n", stdout);
if(success != EOF) {
success = fflush(stdout);
if(success != EOF) return EXIT_SUCCESS;
}
fprintf(stderr, "ERROR: fputs did not succeed in writing our message string(error returned: %s)!\n", strerror(errno));
return EXIT_FAILURE;
} |
Partager