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

22 lines
641 B
Markdown
Raw Normal View History

# g++
2017-11-30 10:38:29 +05:30
> Compiles C++ source files.
> Part of GCC (GNU Compiler Collection).
2019-06-07 11:58:18 +01:00
> More information: <https://gcc.gnu.org>.
2017-11-30 10:38:29 +05:30
- Compile a source code file into an executable binary:
`g++ {{source.cpp}} -o {{output_executable}}`
2017-11-30 12:55:37 +05:30
- Display (almost) all errors and warnings:
2017-11-30 10:38:29 +05:30
`g++ {{source.cpp}} -Wall -o {{output_executable}}`
- Choose a language standard to compile for(C++98/C++11/C++14/C++17):
`g++ {{source.cpp}} -std={{language_standard}} -o {{output_executable}}`
- Include libraries located at a different path than the source file:
`g++ {{source.cpp}} -o {{output_executable}} -I{{header_path}} -L{{library_path}} -l{{library_name}}`