2023-02-21 07:56:04 +01:00
|
|
|
# clang
|
|
|
|
|
|
|
|
> Compiler für C, C++ und Objective-C Quelldateien. Kann als Ersatz für GCC genutzt werden.
|
|
|
|
> Weitere Informationen: <https://clang.llvm.org/docs/ClangCommandLineReference.html>.
|
|
|
|
|
|
|
|
- Kompiliere eine Quelldatei in eine ausführbare Binärdatei:
|
|
|
|
|
2025-03-14 09:18:08 +02:00
|
|
|
`clang {{pfad/zu/quelldatei.c}} {{[-o|--output]}} {{pfad/zu/binärdatei}}`
|
2023-02-21 07:56:04 +01:00
|
|
|
|
|
|
|
- Zeige geläufige Fehler und Warnungen an:
|
|
|
|
|
2025-03-14 09:18:08 +02:00
|
|
|
`clang {{pfad/zu/quelldatei.c}} -Wall {{[-o|--output]}} {{pfad/zu/binärdatei}}`
|
2023-02-21 07:56:04 +01:00
|
|
|
|
|
|
|
- Binde Bibliotheken, die sich an einem anderen Pfad als die Quelldatei befinden, ein:
|
|
|
|
|
2025-03-14 09:18:08 +02:00
|
|
|
`clang {{pfad/zu/quelldatei.c}} {{[-o|--output]}} {{pfad/zu/binärdatei}} -I{{pfad/zu/headerdatei}} -L{{pfad/zu/bibliothek}} -l{{bibliotheks_name}}`
|
2023-02-21 07:56:04 +01:00
|
|
|
|
|
|
|
- Kompiliere eine Quelldatei zu LLVM Intermediate Representation (IR):
|
|
|
|
|
2025-03-14 09:18:08 +02:00
|
|
|
`clang {{[-S|--assemble]}} -emit-llvm {{pfad/zu/quelldatei.c}} {{[-o|--output]}} {{pfad/zu/ir_datei.ll}}`
|
2023-02-21 07:56:04 +01:00
|
|
|
|
|
|
|
- Kompiliere eine Quelldatei, ohne zu Linken:
|
|
|
|
|
2025-03-14 09:18:08 +02:00
|
|
|
`clang {{[-c|--compile]}} {{pfad/zu/quelldatei.c}}`
|