1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/g++.md
Emily Grace Seville 02c427a039
g++, gcc: page update (#7821)
* Update placeholders:
- use "path/to"
- join list of placeholders in gcc

* Suggest language standard in code example

Co-authored-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

Co-authored-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-03-02 21:36:03 +10:00

21 lines
718 B
Markdown

# g++
> Compiles C++ source files.
> Part of GCC (GNU Compiler Collection).
> More information: <https://gcc.gnu.org>.
- Compile a source code file into an executable binary:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}`
- Display (almost) all errors and warnings:
`g++ {{path/to/source.cpp}} -Wall -o {{path/to/output_executable}}`
- Choose a language standard to compile for (C++98/C++11/C++14/C++17):
`g++ {{path/to/source.cpp}} -std={{c++98|c++11|c++14|c++17}} -o {{path/to/output_executable}}`
- Include libraries located at a different path than the source file:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}} -I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}`