C/C++
Installation
-
Download
Visual Studio Build Tools 2022 Installerand run it -
Open
Visual Studio Build Tools 2022and check the following options
-
Go to
Single Componentsection -> search for ‘MSVC (v14.38-17.8)’ and check it -
Click
Install -
Edit
System Environment Variableswith the following variables[SYS] BuildTools: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools[SYS] VCTools: %BuildTools%\VC\Tools[SYS] MSVC_VERSION: 14.42.34433[SYS] WIN_SDK_VERSION: 10.0.20348.0[SYS] WIN10KITS: C:\Program Files (x86)\Windows Kits\10[SYS] INCLUDE: %VCTools%\MSVC\%MSVC_VERSION%\include;%WIN10KITS%\Include\%WIN_SDK_VERSION%\ucrt;%WIN10KITS%\Include\%WIN_SDK_VERSION%\um;%WIN10KITS%\Include\%WIN_SDK_VERSION%\shared;[SYS] LIB: %WIN10KITS%\Lib\%WIN_SDK_VERSION%\um\x64;%WIN10KITS%\Lib\%WIN_SDK_VERSION%\ucrt\x64;%VCTools%\MSVC\%MSVC_VERSION%\lib\x64;[USER] Path:%VCTools%\MSVC\%MSVC_VERSION%\bin\Hostx64\x64%BuildTools%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
Configuration
-
Open Visual Studio Code
-
Ctrl + Shift + X-> Search for “C/C++” ->Install Specific Version...-> 1.21.6 (Versions before 1.22.9) -
Ctrl + Shift + X-> Search for “CMake Tools” -
Ctrl + Shift + P->Preferences: Open User Settings (JSON)-> Insert and set the following param:{"C_Cpp.intelliSenseEngineFallback": "enabled","C_Cpp.default.compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe", // Change to your compiler's path"[cpp]": {"editor.semanticHighlighting.enabled": true,"editor.stickyScroll.defaultModel": "foldingProviderModel","editor.suggest.insertMode": "replace","editor.wordBasedSuggestions": "off"},"cmake.generator": "Visual Studio 17 2022", // Change to your cmake's generator"cmake.cmakePath": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe", // Change to your cmake's path"cmake.pinnedCommands": ["workbench.action.tasks.configureTaskRunner","workbench.action.tasks.runTask"],}
Run Example
Beginner
-
Open Visual Studio Code
-
(Optional)
Ctrl + Shift + P->C/C++: Edit Configurations (JSON)-> Add custom include dirs to “includePath” -
Create a cpp file and write something
-
Press
F5and choose the configuration start with “C/C++“
Intermediate
-
Open Visual Studio Code
-
(Optional)
Ctrl + Shift + P->C/C++: Edit Configurations (JSON)-> Add custom include dirs to “includePath” -
Create a cpp file and write something (and create a header file inside ‘include/’ directory if you want)
-
(Optional)
Ctrl + Shift + P->Preferences: Open Workspace Settings (JSON)-> Insert and set the following param:{"cmake.configureOnOpen": false,"cmake.sourceDirectory": "${workspaceFolder}/", // Change to the dir where CMakeLists.txt will be stored} -
Create a
CMakeLists.txtif not exists# Requiriescmake_minimum_required(VERSION 3.16)set(CMAKE_CXX_STANDARD 17)# Set project nameproject(name_of_the_project)# # Set header directories# include_directories(${PROJECT_SOURCE_DIR}/include)# Set output directoryset(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)# Collect source filesaux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_LIST)# Create executableadd_executable(name_of_the_exe${SRC_LIST}) -
Ctrl + Shift + P->CMake: Select a Kit-> Choose the kit starts with “Visual Studio” -
Ctrl + Shift + P->CMake: Configure-> Select the designated CMakeLists.txt
C#
Installation
Download Microsoft .NET SDK 8.0.411 Installer and run it
The following components should be installed:
- .NET SDK 8.0.411
- .NET Runtime 8.0.17
- ASP.NET Core Runtime 8.0.17
- .NET Windows Desktop Runtime 8.0.17
Configuration
-
Open Visual Studio Code
-
Ctrl + Shift + X-> Search for “C#” ->Install -
Ctrl + Shift + P->Preferences: Open User Settings (JSON)-> Insert and set the following params:{"omnisharp.useModernNet": false,"dotnetAcquisitionExtension.allowInvalidPaths": true,"dotnetAcquisitionExtension.existingDotnetPath": [], // Change to your dotnet's path}
Python
Installation
…
Configuration
-
Open Visual Studio Code
-
Ctrl + Shift + X-> Search for “C#” ->Install -
Ctrl + Shift + P->Preferences: Open User Settings (JSON)-> Insert and set the following params:{"python.defaultInterpreterPath": "C:/Users/Spr_Aachen/AppData/Local/Programs/Python/Python39/python.exe", // Change to your interpreter's path"[python]": {"diffEditor.ignoreTrimWhitespace": false,"editor.formatOnType": true,"editor.wordBasedSuggestions": "off"},}
Common
Other recommanded settings for Visual Studio Code
-
Open Visual Studio Code
-
Ctrl + Shift + P->Preferences: Open User Settings (JSON)-> Insert the following params:{"security.workspace.trust.untrustedFiles": "open","editor.formatOnType": true,"editor.formatOnPaste": true,"editor.maxTokenizationLineLength": 100000,"diffEditor.experimental.showMoves": true,"diffEditor.maxComputationTime": 0,"git.suggestSmartCommit": true,"files.autoGuessEncoding": true,"workbench.startupEditor": "none","workbench.editor.empty.hint": "text",}
Some information may be outdated