1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.de/common/gcc.md

25 lines
818 B
Markdown
Raw Normal View History

2020-10-19 20:11:46 +02:00
# gcc
> Präprozessiert und kompiliert C und C++ Quellcodedateien und linkt diese anschließend zusammen.
> Weitere Informationen: <https://gcc.gnu.org>.
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
- Kompiliere mehrere Quellcodedateien zu einer ausführbaren Datei:
2020-10-19 20:11:46 +02:00
2021-07-02 20:38:46 +01:00
`gcc {{pfad/zu/datei1.c}} {{pfad/zu/datei2.c}} --output {{pfad/zu/binärdatei}}`
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
- Erlaube Warnungen und debug-Symbole in der Ausgabedatei:
2020-10-19 20:11:46 +02:00
2021-07-02 20:38:46 +01:00
`gcc {{pfad/zu/datei.c}} -Wall -Og --output {{pfad/zu/binärdatei}}`
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
- Inkludiere Bibliotheken aus anderen Verzeichnissen:
2020-10-19 20:11:46 +02:00
2021-07-02 20:38:46 +01:00
`gcc {{pfad/zu/datei.c}} --output {{pfad/zu/binärdatei}} -I{{pfad/zu/headerdatei}} -L{{pfad/zu/bibliothek1}} -l{{pfad/zu/bibliothek2}}`
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
- Kompiliere Quellcodedateien zu Assemblerinstruktionen:
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
`gcc -S {{pfad/zu/datei.c}}`
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
- Kompiliere eine oder mehrere Quellcodedateien ohne diese zu linken:
2020-10-19 20:11:46 +02:00
2021-03-25 17:42:04 +01:00
`gcc -c {{pfad/zu/datei.c}}`