![]() |
This repository gathers C++ code examples coming from various websites and books. It also includes build scripts (bash scripts, batch files, Make scripts) for experimenting with C++ on a Windows machine. |
Ada, Akka, COBOL, Dafny, Dart, Deno, Docker, Erlang, Flix, Go, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, Standard ML, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously investigating.
☛ Read the document "History of C++" to get a quick overview of the evolution of C++.
This project depends on the following external software for the Microsoft Windows platform:
- CMake 4.1 (release notes)
- Git 2.51 (release notes)
- LLVM 17 1 (release notes)
- MSYS2 2024 1 2 (changelog)
- oneAPI DPC++ 2025 1 (release notes)
- Visual Studio Community 2019 1 (release notes)
- Windows SDK 10 (release notes)
Optionally one may also install the following software:
- Bazel 8.4 LTS (release notes)
- ConEmu 2023 (release notes)
- Doxygen 1.15 (changelog)
- Embarcadero C++ 7.30 Compiler
- LLVM 19 (release notes)
- OrangeC 6.73 (release notes)
- Visual Studio Code 1.105 (release notes)
- Visual Studio Community 2022 1 (release notes)
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\as the installation directory for optional software tools (in reference to the/opt/directory on Unix).
For instance our development environment looks as follows (October 2025) 3:
C:\opt\bazel\ ( 55 MB) C:\opt\BCC-10.2\ (194 MB) C:\opt\cmake\ (115 MB) C:\opt\ConEmu\ ( 26 MB) C:\opt\doxygen\ (120 MB) C:\opt\Git\ (393 MB) C:\opt\LLVM-17.0.6\ (3.1 GB) C:\opt\LLVM-19.1.3\ (2.0 GB) C:\opt\msys64\ (2.8 GB) C:\opt\orangec\ ( 74 MB) C:\opt\VSCode\ (381 MB) C:\Program Files\Microsoft Visual Studio\2022\Community\ (4.4 GB) C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\ (4.2 GB) C:\Program Files (x86)\Intel\oneAPI\ (3.3 GB) C:\Program Files (x86)\Windows Kits\10\ (6.7 GB)
🔎 Git for Windows provides a BASH emulation used to run
git.exefrom the command line (as well as over 250 Unix commands likeawk,diff,file,grep,more,mv,rmdir,sedandwc).
Directory structure ▴
This project is organized as follows:
bin\
concurrency-examples\{README.md, acquireConsume, etc.}
dmc3-examples\{README.md, cpp20_algebraic_concepts, etc.}
docs\
examples\{README.md, call-by-copy, class-dispatching, etc.}
grimm-examples\{README.md, templateMethod, visitor, etc.}
gui-examples\{README.md, simple-window, etc.}
pthreads-examples\{README.md, fib, myTurn, etc.}
README.md
RESOURCES.md
setenv.bat
where
- directory
bin\contains utility tools. - directory
concurreny-examplescontains C++ code examples from Grimm's book (seeREADME.mdfile). - directory
docs\contains C++ related papers/articles. - directory
examples\contains C++ code examples (seeREADME.mdfile). - directory
grimm-examplescontains C++ code examples from Grimm's website (seeREADME.mdfile). - directory
gui-examplescontains C++ code examples depending on the Win32 API. - directory
pthreads-examples\contains C++ code examples (seeREADME.mdfile). - file
README.mdis the Markdown document for this page. - file
RESOURCES.mdis the Markdown document presenting external resources. - file
setenv.batis the batch script for setting up our environment.
Batch commands ▴
setenv.bat 4
We execute command setenv once to setup our development environment; it makes external tools such as bazel.exe, git.exe and sh.exe directly available from the command prompt.
> setenv Tool versions: bazel 8.4.2, bcc32c 7.30, clang 17.0.6, gcc 15.2.0, icx 2025.0.1, occ 6.73.8 cmake 4.2.0-rc1, cl 19.36.33523, cppcheck 2.18.3, doxygen 1.15.0, msbuild 17.11.2.32701, git 2.51.1, diff 3.12, bash 5.2.37(1) > where bazel git sh C:\opt\bazel\bazel.exe C:\opt\Git\bin\git.exe C:\opt\Git\mingw64\bin\git.exe C:\opt\Git\bin\sh.exe C:\opt\msys64\usr\bin\sh.exe C:\opt\Git\usr\bin\sh.exe
Command setenv help displays the help messsage :
> setenv help Usage: setenv { <option> | <subcommand> } Options: -bash start Git bash shell instead of Windows command prompt -debug print commands executed by this script -verbose print progress messages Subcommands: help print this help message
Footnotes ▴
[1] C++ Compilers ↩
- The installed development tools for Windows give us access to the following C++ compilers:
-
Devtool C++ Compiler Version ISO Standards a) Embarcadero bcc32c.exe7.30 11 LLVM clang.exe17.0.x 98, 11, 14, 17, 20, 2b b) MSVS
(Microsoft)cl.exe19.41.34120 14, 17, 20 MSYS2 g++.exe13.3.0 98, 11, 14, 17, 20, 23 b) oneAPI
(Intel)icx.exe2025.0.1 11, 14, 17, 20 OrangeC
(LADSoft)occ.exe6.73 11, 14 a) Standard specified with compiler option, e.g.-std=c++17; starting with version 2023.0 oneAPI uses C++17 as the default C++ language.
b) ISO standard 23 partially supported.
[2] Cppcheck ↩
-
Cppcheck for Windows is available either as Windows installer or as MSYS2 package.
Since our project depends on MSYS2 we choose to install the MSYS2 package
mingw-w64-x86_64-cppcheck:> %MSYS_HOME%\usr\bin\pacman.exe -Ss cppcheck clangarm64/mingw-w64-clang-aarch64-cppcheck 2.18.3-1 static analysis of C/C++ code (mingw-w64) mingw64/mingw-w64-x86_64-cppcheck 2.18.3-1 [installed] static analysis of C/C++ code (mingw-w64) ucrt64/mingw-w64-ucrt-x86_64-cppcheck 2.18.3-1 static analysis of C/C++ code (mingw-w64) clang64/mingw-w64-clang-x86_64-cppcheck 2.18.3-1 static analysis of C/C++ code (mingw-w64) > %MSYS_HOME%\usr\bin\pacman.exe -Syu mingw-w64-x86_64-cppcheck :: Synchronizing package databases... [...] Packages (4) mintty-1~3.8.1-1 msys2-runtime-3.6.4-2 msys2-runtime-devel-3.6.4-2 pacman-6.1.0-19 Total Download Size: 15.67 MiB Total Installed Size: 81.08 MiB Net Upgrade Size: 3.93 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... [...] > where /r %MSYS_HOME% cppcheck.exe C:\opt\msys64\mingw64\bin\cppcheck.exe
-
Reminder: How we created our MSYS2 installation (installation directory:
MSYS_HOME=C:\opt\msys64) :Executed command Used size (MB) msys2-x86_64-20240727.exe304 %MSYS_HOME%\usr\bin\pacman.exe -S make310 %MSYS_HOME%\usr\bin\pacman.exe -S gcc798 %MSYS_HOME%\usr\bin\pacman.exe -S automake812 %MSYS_HOME%\usr\bin\pacman.exe -S mingw-w64-x86_64-cppcheck843 %MSYS_HOME%\usr\bin\pacman.exe -S texinfo854 (to be updated) ..
[3] Downloads ↩
- In our case we downloaded the following installation files (see section 1):
-
bazel-8.4.2-windows-x86_64.zip ( 50 MB) BCC102.zip (Embarcadero) ( 45 MB) cmake-4.2.0-rc1-windows-x86_64.zip ( 38 MB) ConEmuPack.230724.7z ( 5 MB) doxygen-1.15.0.windows.x64.bin.zip (149 MB) LLVM-17.0.6-win64.exe (263 MB) LLVM-19.1.3-win64.exe (336 MB) msys2-x86_64-20240727.exe ( 86 MB) PortableGit-2.51.1-64-bit.7z.exe ( 46 MB) VSCode-win32-x64-1.104.3.zip (131 MB) w_dpcpp-cpp-compiler_p_2025.0.1.44_offline.exe (1.2 GB) winsdksetup.exe (1.3 MB) ZippedBinaries6738.zip (OrangeC) ( 22 MB)
[4] setenv.bat usage ↩
-
setenv.bathas specific environment variables set that enable us to use command-line developer tools more easily. - It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
-
For instance we can quickly check that the two scripts
Launch-VsDevShell.ps1andVsDevCmd.batare indeed available in our Visual Studio 2019 installation :> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev* C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
-
Concretely, in our GitHub projects which depend on Visual Studio (e.g.
michelou/cpp-examples),setenv.batdoes invokeVsDevCmd.bat(resp.vcvarall.batfor older Visual Studio versions) to setup the Visual Studio tools on the command prompt.
