From 02c427a039d9940a0bad40b5f97fad6fa5ff7e84 Mon Sep 17 00:00:00 2001 From: Emily Grace Seville Date: Wed, 2 Mar 2022 03:36:03 -0800 Subject: [PATCH] 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 Co-authored-by: Muhammad Falak R Wani --- pages/common/g++.md | 10 +++++----- pages/common/gcc.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/common/g++.md b/pages/common/g++.md index 9839df52b..fff147422 100644 --- a/pages/common/g++.md +++ b/pages/common/g++.md @@ -6,16 +6,16 @@ - Compile a source code file into an executable binary: -`g++ {{source.cpp}} -o {{output_executable}}` +`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}` - Display (almost) all errors and warnings: -`g++ {{source.cpp}} -Wall -o {{output_executable}}` +`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): +- Choose a language standard to compile for (C++98/C++11/C++14/C++17): -`g++ {{source.cpp}} -std={{language_standard}} -o {{output_executable}}` +`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++ {{source.cpp}} -o {{output_executable}} -I{{header_path}} -L{{library_path}} -l{{library_name}}` +`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}} -I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}` diff --git a/pages/common/gcc.md b/pages/common/gcc.md index fd34bcb97..63041a49c 100644 --- a/pages/common/gcc.md +++ b/pages/common/gcc.md @@ -5,20 +5,20 @@ - Compile multiple source files into executable: -`gcc {{source1.c}} {{source2.c}} --output {{executable}}` +`gcc {{path/to/source1.c path/to/source2.c ...}} --output {{path/to/output_executable}}` - Allow warnings, debug symbols in output: -`gcc {{source.c}} -Wall -Og --output {{executable}}` +`gcc {{path/to/source.c}} -Wall -Og --output {{path/to/output_executable}}` - Include libraries from a different path: -`gcc {{source.c}} --output {{executable}} -I{{header_path}} -L{{library_path}} -l{{library_name}}` +`gcc {{path/to/source.c}} --output {{path/to/output_executable}} -I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}` - Compile source code into Assembler instructions: -`gcc -S {{source.c}}` +`gcc -S {{path/to/source.c}}` - Compile source code without linking: -`gcc -c {{source.c}}` +`gcc -c {{path/to/source.c}}`