Win32 API
Notes on building a Win32 C++ executable from VS Code with the MSVC toolchain. For the MSYS2/GCC toolchain instead, see C++.
Create a project in VS Code
- Press
Ctrl+Shift+Pand run CMake: Quick Start. - Choose the kit Visual Studio Community 2022 Release - amd64.
- Select C++, then Executable.
- Press
Ctrl+Shift+Pand run CMake: Configure. - Start debugging with C/C++: cl.exe build and debug active file.
Preprocessor
# Run the preprocessor without compiling.
# This can make the debugger behave erratically, so use it only for inspection.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /P")