Compilación básica con gcc¶
Ejemplo de compilación de un programa sencillo en C Hello world¶
Codigo fuente en lenguaje C del programa hello.c¶
1 2 3 4 5 6 7 8 9 10 11 12 | // hello.c
// Here, is a Hello World program in C
// G.A. 2020
//
#include <stdio.h> // Pre-procesor directive (include stdio.h header file)
int main() { // main function declaration (program entry point)
printf("Hello, world!\n"); // Function to print "Hello world" string to Standard Output
return 0; // C instruction to return from a function
}
|
Compilar y montar (link) simple del fichero hello.c y generar el ejecutable hello¶
$ gcc hello.c -o hello
Ejecutar el programa¶
$ ./hello