tldr/pages/common/g++.md

21 lines
604 B
Markdown
Raw Normal View History

2017-11-30 07:25:37 +00:00
# gplusplus
2017-11-30 05:08:29 +00:00
> Compiles C++ source files.
> Part of GCC (GNU Compiler Collection).
- Compile a source code file into an executable binary:
`g++ {{source.cpp}} -o {{output_executable}}`
2017-11-30 07:25:37 +00:00
- Display (almost) all errors and warnings:
2017-11-30 05:08:29 +00:00
`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}}`