2 KiB
Visual Studio Dependencies
Install dependencies
For developing C++ in Visual Studio 2022 on Windows 11 you have to install the Desktop development with C++. If you don't do this, the C++ capabilities will not be available.
C++ Console Application
To create a C++ Console Application you have to create a new Project. In Visual Studio you select Windows Desktop Wizard. After naming the project the IDE opens the Windows Desktop Project window. Make sure the Application type is on Console Application (.exe) and that the Precompiled Header option is unselected.
Compiler Extensions
Best Practice
Disable compiler extensions to ensure your programs (and coding practice) remain compliant with C++ standards and will work on any System.
To do this you have to right click on your project name in the Solution Explorer window, then choose Properties. First make sure the configuration is set to All Configurations. Then, click C/C++ > Language tab, and set _Conformance mode _ to Yes(/permissive-).
Warning and Error levels
Best Practice
Don't let warnings pile up. resolve them as you encounter them (as if they were errors). Otherwise a warning about a serious issue may be lost amongst warnings about non-serious issues.
You IDE can support you by handling the warnings. In the Solution Properties you can turn up your warning levels. To increase them, go to the Properties of your solution and then you have to set for All Configurations in _C/C++ > General _ then Warning levels to Level4 (/W4) and for more support the Treat Warnings As Errors to Yes (/WX).
Language standard
To select a language standard, open your solution properties, then open C/C++ > Language. Make sure the Configuration is set to All Configurations. From there, you can set the C++ Language Standard to the version of C++ you wish to use.
Warning
With Visual Studio, you will need to reselect your language standard every time you create a new project.