Configuring MSVC2019 in Code::Blocks
Configuring MSVC2019 in Code::Blocks
https://github.com/arnholm/cpde_utils
Table of Contents
Introduction.............................................................................................................................................................................................................................3
Global variable settings..........................................................................................................................................................................................................4
MSVC................................................................................................................................................................................................................................4
MSVC_TOOLCHAIN.......................................................................................................................................................................................................5
NET_SDK..........................................................................................................................................................................................................................6
WIN_SDK..........................................................................................................................................................................................................................7
WIN_SDK_LIB.................................................................................................................................................................................................................8
Compiler settings....................................................................................................................................................................................................................9
Switching between MSVC compilers...................................................................................................................................................................................14
Introduction
The basic idea is to let Code::Blocks project files be independent of the MSVC compiler version. We therefore define a user defined compiler in
Code::Blocks and call in ‘MSVC’. All project files refer to this compiler only.
Also, we define the MSVC compiler in terms of Code::Blocks global variables with user defined fields. An overview is given in the table below.
The ‘sdk_version’ field corresponds to the “Windows Kits” version you are using, e.g.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0
The ‘arch’ field should be ‘x64’ for 64-bit or ‘x86’ for 32-bit
MSVC_TOOLCHAIN
Defines .NET SDK include and library paths. Not required for native C++ only.
WIN_SDK
Defines Windows SDK include paths as well as binary path (binary path not used for now).
WIN_SDK_LIB
Defines Windows SDK library paths
Compiler settings
The following pages show the settings required to define the MSVC user defined compiler, based on the global variable settings.
Switching between MSVC compilers
Sometimes it is required to have more than one MSVC compiler installed. In order to switch between such compilers it is typically required to have
multiple global variable sets and also multiple compiler definitions. In Code::Blocks, you can select a global variable set, but redefining the MSVC
compiler is cumbersome. Therefore a tool (cb_config, part of cpde_utils) has been developed that modifies the Code::Blocks config.conf file to do this
more easily (it requires all instances of Code::blocks to be closed before it is used).
For example, you can have MSVC2013 and MSVC2019 installed at the same time, with corresponding global variable sets for each compiler.
Switching between compilers means to redefine the MSVC compiler based on MSVC2013 or MSVC2019. As the two compilers are very different it is
usually required to use different global variable sets. After selecting and saving (File → Save), Code::Blocks is configured accordingly on next startup.