C - Compilieren: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „=Sourcecode= *cat hello-world.c <pre> #include <stdio.h> int main(void) { puts("Hallo Welt!"); } </pre> =Compile= *gcc hello-world.c -o hello-world =Res…“) |
|||
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| + | =Compilere installieren= | ||
| + | ;Debian | ||
| + | *sudo apt install -y gcc | ||
| + | ;Rocky | ||
| + | *sudo dnf install -y gcc | ||
| + | |||
=Sourcecode= | =Sourcecode= | ||
*cat hello-world.c | *cat hello-world.c | ||
| Zeile 18: | Zeile 24: | ||
*./hello-world | *./hello-world | ||
Hallo Welt! | Hallo Welt! | ||
| + | =Cross Compiler= | ||
| + | *apt install mingw-w64 | ||
| + | |||
| + | *x86_64-w64-mingw32-gcc -o hello-world.exe hello-world.c | ||
Aktuelle Version vom 24. August 2026, 12:43 Uhr
Compilere installieren
- Debian
- sudo apt install -y gcc
- Rocky
- sudo dnf install -y gcc
Sourcecode
- cat hello-world.c
#include <stdio.h>
int main(void)
{
puts("Hallo Welt!");
}
Compile
- gcc hello-world.c -o hello-world
Result
file *
hello-world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked ... hello-world.c: C source, ASCII text
Run
- ./hello-world
Hallo Welt!
Cross Compiler
- apt install mingw-w64
- x86_64-w64-mingw32-gcc -o hello-world.exe hello-world.c