- Notifications
You must be signed in to change notification settings - Fork20
Complete, working programs, plus Markdown sources, from the C++ tutorial hosted at learnmoderncpp.com
License
cpp-tutor/learnmoderncpp-tutorial
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
All of the source Markdown pages for the Modern C++ Tutorial onhttps://learnmoderncpp.com/ plus complete, working programs machine-extracted from the course text.
Note: Some Chapters have had significant changes made to update them to C++23, and not all programs compile successfully yet. In particular, use ofstd::println() withimport std; does not compile. In case of issues with your compiler please see the Releases page for the C++20 version of the Tutorial.
New: Jupyter Notebooks have been auto-generated from the source Markdown files and are located in thejupyter-notebooks directory. You will need the executablejupyter-lab available with suitable C++ kernels, see output from runningjupyter kernelspec list (tested with kernelcpp23, which needs to be set on first load).
The "headers" subdirectory contains C++ programs with legacy header#includes, whilst the "modules" subdirectory contains the same programs using theimport keyword instead. Seehttps://learnmoderncpp.com/2020/09/05/where-are-c-modules/ for more details about C++ compilers which have support for modules.
The "scripts" subdirectory contains a C++ program which extracts all programs from the Markdown source to the above two folders.
Most programs compile successfully under Windows with Visual Studio 2022 (v17.8 or later), some of the modules versions (as noted above) do not currently compile.
The supplied batch scriptsbuild-vs2022-headers.bat andbuild-vs2022-modules.bat can be used to compile all of the programs within a Visual Studio command prompt, simply run:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bator similar in a command window, or create a desktop link, and then run either of the build scripts.
Alternatively, to compile individual programs from within a Visual Studio command prompt, run either (modules):
cl /EHsc /std:c++latest /MTd 00-example.cppor (headers):
cl /EHsc /std:c++latest 00-example.cppsubstituting the correct file for00-example.cpp in either case. Note that the modules versions need filestd.obj in the current directory, see the build script for how to create this.
To compile individual programs in the "headers" subdirectory under Linux, use:
g++ -std=c++23 -o 00-example 00-example.cppor:
clang++ -std=c++23 -o 00-example 00-example.cppsubstituting both occurrencies of00-example with the correct file name.
Alternatively, run one of the supplied shell scriptsbuild-gcc-headers.sh orbuild-clang-headers.sh which are supplied in the "headers/build" subdirectory, orbuild-clang-modules.sh found in the "modules/build" subdirectory.
About
Complete, working programs, plus Markdown sources, from the C++ tutorial hosted at learnmoderncpp.com
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors4
Uh oh!
There was an error while loading.Please reload this page.