Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
90 views

Configuring MSVC2019 in Code::Blocks

This document provides instructions for configuring the Microsoft Visual Studio 2019 compiler (MSVC2019) in the Code::Blocks IDE. It involves defining a user compiler called "MSVC" and several global variables to specify settings like the compiler/linker tools, SDK paths, and architecture. Compiler settings in Code::Blocks then reference these variables. A separate tool can switch between different MSVC compiler configurations by modifying Code::Blocks' configuration file.

Uploaded by

tomlulu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Configuring MSVC2019 in Code::Blocks

This document provides instructions for configuring the Microsoft Visual Studio 2019 compiler (MSVC2019) in the Code::Blocks IDE. It involves defining a user compiler called "MSVC" and several global variables to specify settings like the compiler/linker tools, SDK paths, and architecture. Compiler settings in Code::Blocks then reference these variables. A separate tool can switch between different MSVC compiler configurations by modifying Code::Blocks' configuration file.

Uploaded by

tomlulu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Configuring MSVC2019 in Code::Blocks

A quick summary on how to use the


Microsoft Visual Studio 2019 Enterprise compiler (MSVC2019)
in Code::Blocks

Carsten Arnholm - January 2020

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.

Code::Blocks Global variable Description


MSVC A set of user defined fields used by other global fields. This reduces the changes between the
variable sets to a minimum
MSVC_TOOLCHAIN Defines MSVC, IDE, compiler, linker and related tools
NET_SDK Defines .NET SDK include and library paths
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
Global variable settings
MSVC
The ‘release’ field corresponds to the currently installed Visual studio version, as identified in e.g.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314

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 MSVC, IDE, compiler, linker and related tools


NET_SDK

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.

You might also like