C - Compilieren: Unterschied zwischen den Versionen

Aus Xinux Wiki
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…“)
 
 
Zeile 18: Zeile 18:
 
*./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 25. Juni 2026, 08:31 Uhr

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