Visual Studio C++ IDE settings

Or makefiles to anyone else…

This is just to make sure I can reproduce the exact builds when using Visual Studio’s IDE. The settings tend to be in dialogue boxes that require manual changes. These instructions show where to find the key changes.

Two main sections. There is the IDE settings themselves and also the projects Configuration Properties. Note that debugging is in with the IDE and not with the compiler configuration.

Further down will be a discussion on how to update Visual Studio directly via its XML files.

Now you are here…

Sorry about this, but this is really a work in progress. Comeback later when this is wrapped up. Until then it will be place to build up what settings seem right and the best way to get them set.

IDE Extensions

Column Guidelines

Add them using this extensions. Set to 80 and 120 and the size used for this website.

https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelinesPreview

Add them when the editor cursor is at 80 and 120 which is actually one character less than an actual 80 characters. This is to makes sure it fits in all cases, even when the newline is counted.

Comment Reflow at 80 Columns

Add comment reflow from here:

https://marketplace.visualstudio.com/items?itemName=stkb.Rewrap-18980

Alt-Q several times to change between more than one column guideline. (if the setting is changed).

Use colon and * to format the text.

Double space at end of a line will preserve the newline.

IDE Settings

Menu -> Tools -> Options…

C/C++

Scroll Bars: Use map mode for vertical scroll bar, Wide

Debugging

General -> Enable Just My Code (Turn off for stepping through the STL implementation.

Configuration Properties

These can also be set via putting all the values in a .props file. More on that below.

Menu -> Project -> Properties

Only use x64 (Debug and Release).

C/C++ -> Language -> C++ Language Standard -> ISO C++ 17 Standard (/std:c++17)

C/C++ -> General -> Warning Level -> EnableAllWarnings (/Wall)

C/C++ -> General -> Additional Include Directories -> “…/include/”

Note this is confusing as there are other locations that will also work.

C/C++ Precompiled Headers -> Not Using Precompiled Headers

C/C++ -> General -> Treat Warnings as Errors -> Yes (/WX)

C/C++ -> Code Generation -> Enable C++ Exceptions -> No (/EHsc etc are all off).

C/C++ -> Advanced -> Disable Specific Warnings -> 4577
This is required as calling an inherited destructor generates an error in an internal compiler header:

<project path>\predefined C++ types (compiler internal)(44,21): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc

This warning was already turned off using pragmas, but they don’t affect this internal compiler ‘file’.

pragma warning (disable : 4577) // 'noexcept' used with no exception handling mode specified

TODO: Lots of other changes to get a minimal command line. I would like to justify each option. Currently at this:

/JMC 
/permissive- 
/ifcOutput "x64\Debug\" 
/GS 
/Wall 
/Zc:wchar_t 
/ZI 
/Gm- 
/Od 
/sdl 
/Fd"x64\Debug\vc142.pdb" 
/Zc:inline 
/fp:precise 
/D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" 
/errorReport:prompt 
/WX 
/Zc:forScope 
/RTC1 
/Gd 
/MDd 
/FC 
/Fa"x64\Debug\" 
/EHsc 
/nologo 
/Fo"x64\Debug\" 
/Fp"x64\Debug\includeTests.pch" 
/diagnostics:column 

Tabs and Spaces

Set files to convert to spaces.

Tabs are set to 4.

.Props XML Files to set the Build

TODO…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.