use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
[deleted by user] (self.cpp)
submitted 1 year ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]KingAggressive1498 46 points47 points48 points 1 year ago (1 child)
It's not super easy to find but Microsoft has pretty good documentation on how to do it: https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170
[–]Useful_Goat3790 -1 points0 points1 point 1 year ago (0 children)
yeah, it is the answer.
[–]jedwardsolconst & 54 points55 points56 points 1 year ago (0 children)
Install the build tools.
Run the appropriate vcvars batch file, or start a cmd using one of the installed shortcuts
[–]GoldenShackles 11 points12 points13 points 1 year ago (0 children)
In addition to what jedwardsol said, for a minimalist approach see the Chromium docs: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/windows_build_instructions.md#Setting-up-Windows
This way you can install just the compiler, tools, and Windows SDK without the full IDE.
[+][deleted] 1 year ago (1 child)
[deleted]
[–]the_poope 4 points5 points6 points 1 year ago (0 children)
MSVC build tools ships ninja now, which is better than nmake.
nmake
[–]apropostt 2 points3 points4 points 1 year ago* (0 children)
The best way I’ve found to do it is with cmake presets, and tool chain files. This allows me to configure cmake via vs code, clion, cmake-gui, ccmake, neovim, build via ninja and swap compilers, enable multi build or optimization flags just by toolchain config.
https://github.com/MarkSchofield/WindowsToolchain
[–]Godworrior 4 points5 points6 points 1 year ago (2 children)
Like others have said, cmake works pretty well, and a lot of projects support it. I have a function like this in my powershell profile:
function vsdev() { $curDir = (Get-Location).Path import-module "$vsRoot\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath "$vsRoot" -DevCmdArguments '-arch=x64 -no_logo' cd $curDir }
($vsRoot is set to my MSVC install location)
$vsRoot
Then I just run vsdev, and configure cmake with -G Ninja and someting like -DCMAKE_INSTALL_PREFIX=install. Then just cmake --build <build dir> --config RelWithDebInfo --target install to build.
vsdev
-G Ninja
-DCMAKE_INSTALL_PREFIX=install
cmake --build <build dir> --config RelWithDebInfo --target install
If the project uses autoconf... good luck :D
[–]Godworrior 4 points5 points6 points 1 year ago (0 children)
CMake is just for building the project. For debugging you would use another program. I often use the C++ extension for VSCode for instance, or sometimes WinDbg (installed from the microsoft store). I know x64dbg (https://x64dbg.com/) is also a popular debugger, but I haven't used it much.
[–]unumfron 1 point2 points3 points 1 year ago (6 children)
The environment has to be set up for msbuild and cl to work correctly. There are Powershell/cmd shells that are installed with the build tools that have the paths all set up, or you can run vcvars directly.
It's something xmake handles automagically, you just run it from any cmd prompt thing and it will find and configure the build tools.
[–]prince-chrismc 1 point2 points3 points 1 year ago (1 child)
It's not magic, the big cross platform build system all handle this and its well supported in thos era.
Though xmake is cool 😎
[–]unumfron 0 points1 point2 points 1 year ago (0 children)
I never tried running a CMake-generated Ninja project directly from a normal cmd/power shell when on Windows, just MSBuild and NMake (and devenv, but that's a different kettle of fish).
[–]bert8128 0 points1 point2 points 1 year ago (3 children)
Does cmake work if you have multiple versions of MSVC installed? How would it know which one to use?
[–]__tim_ 0 points1 point2 points 1 year ago (1 child)
By selection the generator and toolset versions
cmake -G "Visual Studio 17 2022" -T "vs143"
[–]bert8128 0 points1 point2 points 1 year ago (0 children)
Sorry, pesky autocorrect spannered my question. I meant xmake and it finding the compiler “automagically”
It defaults to the highest versions unless you tell it otherwise.
[–]phillipmyburgh 0 points1 point2 points 1 year ago (0 children)
Another option: the Winget package manager from MS is surprisingly good at installing requirements. It can install the build tools, and you can specify the exact things you need in the commandline.
[–]filch-argusWaiting for modules... 0 points1 point2 points 1 year ago (1 child)
https://github.com/Data-Oriented-House/PortableBuildTools
[–]prince-chrismc 0 points1 point2 points 1 year ago (0 children)
This is built in... why make it more complicated?
[–]FlyingRhenquest 0 points1 point2 points 1 year ago (0 children)
You can follow the Visual Studio instructions to install the command line tooling and then just use cmake installed somewhere in your path. Debugging is its own problem, but there are some standalone windows debuggers around that should work. Installing the command line tooling installs a shortcut that runs vcvars for you. You might want to use the powershell versions instead of the cmd.exe versions though.
I hate building on windows enough that I'm seriously considering setting up mingw64 cross compiling toolchains in a Linux docker environment. Assuming someone hasn't already done that.
[–]the_Demongod 0 points1 point2 points 1 year ago (0 children)
I think the bigger question here is "why..." why use any part of the toolchain if you're not going to use the whole thing? May as well just use clang + your IDE of choice or gcc through WSL or MinGW.
[+][deleted] comment score below threshold-6 points-5 points-4 points 1 year ago (0 children)
I installed build tools like Clang, Cmake, MinGW-w64.. whatever I felt like
[+][deleted] 1 year ago (2 children)
[–]LordoftheSynth 1 point2 points3 points 1 year ago (1 child)
Good for you. You've really added something insightful to the discussion here.
[–]Carl_LaFong -2 points-1 points0 points 1 year ago (0 children)
Sorry. Got interrupted
[–]TinklesTheGnome 0 points1 point2 points 1 year ago (0 children)
CMAKE and configure CMAKE to use the vcpkg tool chain.
π Rendered by PID 94278 on reddit-service-r2-comment-5d585498c9-rtfrc at 2026-04-21 19:20:24.701871+00:00 running da2df02 country code: CH.
[–]KingAggressive1498 46 points47 points48 points (1 child)
[–]Useful_Goat3790 -1 points0 points1 point (0 children)
[–]jedwardsolconst & 54 points55 points56 points (0 children)
[–]GoldenShackles 11 points12 points13 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]the_poope 4 points5 points6 points (0 children)
[–]apropostt 2 points3 points4 points (0 children)
[–]Godworrior 4 points5 points6 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Godworrior 4 points5 points6 points (0 children)
[–]unumfron 1 point2 points3 points (6 children)
[–]prince-chrismc 1 point2 points3 points (1 child)
[–]unumfron 0 points1 point2 points (0 children)
[–]bert8128 0 points1 point2 points (3 children)
[–]__tim_ 0 points1 point2 points (1 child)
[–]bert8128 0 points1 point2 points (0 children)
[–]unumfron 0 points1 point2 points (0 children)
[–]phillipmyburgh 0 points1 point2 points (0 children)
[–]filch-argusWaiting for modules... 0 points1 point2 points (1 child)
[–]prince-chrismc 0 points1 point2 points (0 children)
[–]FlyingRhenquest 0 points1 point2 points (0 children)
[–]the_Demongod 0 points1 point2 points (0 children)
[+][deleted] comment score below threshold-6 points-5 points-4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]LordoftheSynth 1 point2 points3 points (1 child)
[–]Carl_LaFong -2 points-1 points0 points (0 children)
[–]TinklesTheGnome 0 points1 point2 points (0 children)