English
Summary
Conclusions
C++ lets you create native programs and use different ways of organizing code. The edition of the standard, the compiler version, and the project settings are different characteristics. The examples in this topic require a current MSVC, a standard library with std::println, the /std:c++latest mode, and UTF-8. The path with the <print> header works both in a Visual Studio project and in a simple cl command; the import std; path requires preparing the module.
Preprocessing, compilation, and linking turn source code into an executable file. A successful build checks only part of correctness: you need to compare the result with the expected one. Git stores clear steps in the development of a program, and .gitignore separates source materials from build outputs. Publishing to GitHub complements the local history but doesn’t replace it.
Self-check questions
- Which problems motivate the use of C++, and what responsibilities does the developer have?
- How does the C++ standard differ from MSVC and Visual Studio?
- Why doesn’t
/std:c++latestguarantee full support for C++26? - Which standard do
std::printlnand thestdmodule belong to? - What is a translation unit, and why do you need a linker?
- How do
.cpp,.obj,.exe, and.vcxprojfiles differ in purpose? - Which Installer workload is required for a C++ console project?
- Why should properties be checked for all configurations?
- What do
int,main,std::, andreturn 0mean in the first program? - How does
#include <print>differ fromimport std;when building? - How do
{:<28}and{:.2f}affect the output? - How does a compilation error differ from a linker error and a logic error?
- Why do you need Developer PowerShell, and what does
$LASTEXITCODEshow? - How do saving a file,
git add,git commit, andgit pushdiffer? - Which project files should be stored in Git, and what is
.gitignorefor?
Review questions for the lab
- What stages does a
.cppfile go through before an executable file appears? - What are
<print>, themainfunction, andreturn 0needed for? - How does the
/std:c++latestmode differ from full support for the standard? - What do the width, the alignment, and
.2fdenote in a format string? - Why doesn’t changing the source code without rebuilding change the
.exe? - How do Debug and Release differ, and why can their text output be the same?
- What is
/utf-8used for, and what else affects how the console looks? - How do the working directory, the index, and a local Git commit differ?
- Which project files should be stored in Git, and which should be ignored?
- Where does
git restore -- main.cppget the contents from, and what should you check before restoring a file?
Useful links
- C++ standardization: https://isocpp.org/std/status.
- Microsoft C++ documentation: https://learn.microsoft.com/cpp/.
- MSVC feature support: https://learn.microsoft.com/cpp/overview/visual-cpp-language-conformance.
- Library modules: https://learn.microsoft.com/cpp/cpp/tutorial-import-stl-named-module.
- UTF-8 in MSVC: https://learn.microsoft.com/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8.
- A Git tutorial: https://git-scm.com/docs/gittutorial.
- Ignore rules: https://git-scm.com/docs/gitignore.
- GitHub documentation: https://docs.github.com/get-started.