Как добавить в visual studio 2017 c
How can I switch compiling from C++14 to C++17 in Microsoft Visual Studio?
Or it's not avaiable in release versions of VS?
Which C++17 features? Which version of Visual Studio? If you're asking about C++17 why did you tag your question c++11 and c++14 ?
c++17 wasn't available, and I thought that those who are interested in specific versions of C++ knows better how to switch it. For example I want std::vector.emplace_back() to give back a reference to the newly created element. I know that +1 line, and I get that reference, But I would like to know the answer to my question anyway. VS Community 2015 (14.0.25431.01 Update 3)
You can't enable specific language dialects in VS, you get whatever they've implemented. You might have pretty good luck with standard library features voted into C++17 if you're using VS21015, but not so much with language features.
7 Answers 7
There's now a drop down (at least since VS 2017.3.5) where you can specifically select C++17. The available options are (under project > Properties > C/C++ > Language > C++ Language Standard)
- ISO C++14 Standard. msvc command line option: /std:c++14
- ISO C++17 Standard. msvc command line option: /std:c++17
- ISO C++20 Standard. msvc command line option: /std:c++20
Any Visual Studio:
- The latest draft standard. msvc command line option: /std:c++latest
The syntax -std:c++14 , -std:c++17 and -std:c++latest also works, e.g. when you prefer to manually enter compiler options (tested with VS2017).
Is that not clear from the answer already, or do you specifically mean - instead of the /std: switches I list?
I see the benefit when coming from gcc or clang . Then the - is less intrusive (however the syntax still differs slightly ( : instead of = )).
@AndreiKrasutski. There is no ISO C++20 yet but some support in /std:c++latest. The C++20 standard is expected next year. I Edited in a comment in my answer.
What C++ standard is used if there is nothing selected in Visual Studio 2017 > Project Properties > C / C++ > Language > C++ Standard dropdown? I have 14, 17 and latest in the dropdown, but none is selected, so how do I find what c++ standard is used in a project in that case?
MSBuild (Visual Studio project/solution *.vcproj/*.sln):
Add to Additional options in Project Settings: /std:c++latest to enable latest features - currently C++17 as of VS2017, VS2015 Update 3.
/permissive- will disable non-standard C++ extensions and will enable standard conformance in VS2017.
VS2017 supports: /std:[c++14|c++17|c++latest] now. These flags can be set via the project's property pages:
- Open the project's Property Pages dialog box. For details, see Working with Project Properties.
- Select Configuration Properties, C/C++, Language.
- In C++ Language Standard, choose the language standard to support from the dropdown control, then choose OK or Apply to save your changes.
CMake:
Visual Studio 2017 (15.7+) supports CMake projects. CMake makes it possible to enable modern C++ features in various ways. The most basic option is to enable a modern C++ standard by setting a target's property in CMakeLists.txt:
In the case of an interface library:
Visual Studio 2015 Update 3 does not support the C++17 feature you are looking for ( emplace_back() returning a reference).
Visual studio 2019 version:
The drop down menu was moved to:
- Right click on project (not solution)
- Properties (or Alt + Enter)
- From the left menu select Configuration Properties
- General
- In the middle there is an option called "C++ Language Standard"
- Next to it is the drop down menu
- Here you can select Default, ISO C++ 14, 17 or latest
Remember to do this for 'All Configurations' and 'All Platforms'. That's from someone who's spent an 2 hour figuring out why it still doesn't work! But thanks for the answer.
In the vs2019 that Unreal setup, there is no Configuration Settings -> General -> C++ Language Standard. Can it be added? There is an nmake -> Additional Options that is set to /std:c++14 . but changing it to c++17 doesn't seem to work.
If bringing existing Visual Studio 2015 solution into Visual Studio 2017 and you want to build it with c++17 native compiler, you should first Retarget the solution/projects to v141 , THEN the dropdown will appear as described above ( Configuration Properties -> C/C++ -> Language -> Language Standard)
I configured it to c++17 in project properties, still I get the same issue of "There is no execution library". I am first time experimenting with C++17 parallel features. This is I am doing on window with visual studio 2017.
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
VS Code 2020 version
In tasks.json file, (after you build and debug with the g++-9 )
Add -std=c++2a for 2020 features ( c++1z for 2017 features). Add -fconcepts to use concept keyword
now compile and you can use the 2020 features.
But the question is not asking "only-for" VS Studio. If you re-read the question, at the end of the line "it's not avaiable in release versions of VS?". The question is flexible, no need to be strict.
This question is not that flexible, and if it were, it would need to be closed. It wouldn't be focused enough. VS Code is not a different version of Visual studio. One is an Integrated Development Environment, and one is an Editor. One pulls up the code that you write, the other is embedded into the file system of the project it is working on. One is funded by Microsoft, one is developed by Microsoft. One is portable to Linux, one is not. A configuration for one, will not work for the other. You might as well answer how to compile C++17 in Notepad.
If you haven't downloaded and installed Visual Studio and the Microsoft C/C++ tools yet, here's how to get started.
Visual Studio 2022 Installation
Welcome to Visual Studio 2022! In this version, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Want to know more about what else is new in this version? See the Visual Studio release notes.
Ready to install? We'll walk you through it, step-by-step.
Step 1 - Make sure your computer is ready for Visual Studio
Before you begin installing Visual Studio:
Check the system requirements. These requirements help you know whether your computer supports Visual Studio 2022.
Apply the latest Windows updates. These updates ensure that your computer has both the latest security updates and the required system components for Visual Studio.
Reboot. The reboot ensures that any pending installs or updates don't hinder the Visual Studio install.
Free up space. Remove unneeded files and applications from your %SystemDrive% by, for example, running the Disk Cleanup app.
For questions about running previous versions of Visual Studio side by side with Visual Studio 2022, see the Visual Studio 2022 Platform Targeting and Compatibility page.
Step 2 - Download Visual Studio
Next, download the Visual Studio bootstrapper file. To do so, choose the following button to go to the Visual Studio download page. Select the edition of Visual Studio that you want and choose the Free trial or Free download button.
Step 3 - Install the Visual Studio installer
Run the bootstrapper file you downloaded to install the Visual Studio Installer. This new lightweight installer includes everything you need to both install and customize Visual Studio.
From your Downloads folder, double-click the bootstrapper that matches or is similar to one of the following files:
- vs_community.exe for Visual Studio Community
- vs_professional.exe for Visual Studio Professional
- vs_enterprise.exe for Visual Studio Enterprise
If you receive a User Account Control notice, choose Yes to allow the bootstrapper to run.
We'll ask you to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement. Choose Continue.
Step 4 - Choose workloads
After the installer is installed, you can use it to customize your installation by selecting the workloads, or feature sets, that you want. Here's how.
Find the workload you want in the Installing Visual Studio screen.
For core C and C++ support, choose the "Desktop development with C++" workload. It comes with the default core editor, which includes basic code editing support for over 20 languages, the ability to open and edit code from any folder without requiring a project, and integrated source code control.
Additional workloads support other kinds of development. For example, choose the "Universal Windows Platform development" workload to create apps that use the Windows Runtime for the Microsoft Store. Choose "Game development with C++" to create games that use DirectX, Unreal, and Cocos2d. Choose "Linux development with C++" to target Linux platforms, including IoT development.
The Installation details pane lists the included and optional components installed by each workload. You can select or deselect optional components in this list. For example, to support development by using the Visual Studio 2017 or 2015 compiler toolsets, choose the MSVC v141 or MSVC v140 optional components. You can add support for MFC, the experimental Modules language extension, IncrediBuild, and more.
After you choose the workload(s) and optional components you want, choose Install.
Next, status screens appear that show the progress of your Visual Studio installation.
At any time after installation, you can install workloads or components that you didn't install initially. If you have Visual Studio open, go to Tools > Get Tools and Features. which opens the Visual Studio Installer. Or, open Visual Studio Installer from the Start menu. From there, you can choose the workloads or components that you wish to install. Then, choose Modify.
Step 5 - Choose individual components (Optional)
If you don't want to use the Workloads feature to customize your Visual Studio installation, or you want to add more components than a workload installs, you can do so by installing or adding individual components from the Individual components tab. Choose what you want, and then follow the prompts.
Step 6 - Install language packs (Optional)
By default, the installer program tries to match the language of the operating system when it runs for the first time. To install Visual Studio in a language of your choosing, choose the Language packs tab from the Visual Studio Installer, and then follow the prompts.
Change the installer language from the command line
Another way that you can change the default language is by running the installer from the command line. For example, you can force the installer to run in English by using the following command: vs_installer.exe --locale en-US . The installer will remember this setting when it's run the next time. The installer supports the following language tokens: zh-cn, zh-tw, cs-cz, en-us, es-es, fr-fr, de-de, it-it, ja-jp, ko-kr, pl-pl, pt-br, ru-ru, and tr-tr.
Step 7 - Change the installation location (Optional)
You can reduce the installation footprint of Visual Studio on your system drive. You can choose to move the download cache, shared components, SDKs, and tools to different drives, and keep Visual Studio on the drive that runs it the fastest.
You can select a different drive only when you first install Visual Studio. If you've already installed it and want to change drives, you must uninstall Visual Studio and then reinstall it.
Step 8 - Start developing
After Visual Studio installation is complete, choose the Launch button to get started developing with Visual Studio.
On the start window, choose Create a new project.
In the search box, enter the type of app you want to create to see a list of available templates. The list of templates depends on the workload(s) that you chose during installation. To see different templates, choose different workloads.
You can also filter your search for a specific programming language by using the Language drop-down list. You can filter by using the Platform list and the Project type list, too.
Visual Studio opens your new project, and you're ready to code!
Visual Studio 2019 Installation
Welcome to Visual Studio 2019! In this version, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Want to know more about what else is new in this version? See the Visual Studio release notes.
Ready to install? We'll walk you through it, step-by-step.
Step 1 - Make sure your computer is ready for Visual Studio
Before you begin installing Visual Studio:
Check the system requirements. These requirements help you know whether your computer supports Visual Studio 2019.
Apply the latest Windows updates. These updates ensure that your computer has both the latest security updates and the required system components for Visual Studio.
Reboot. The reboot ensures that any pending installs or updates don't hinder the Visual Studio install.
Free up space. Remove unneeded files and applications from your %SystemDrive% by, for example, running the Disk Cleanup app.
For questions about running previous versions of Visual Studio side by side with Visual Studio 2019, see the Visual Studio 2019 Platform Targeting and Compatibility page.
Step 2 - Download Visual Studio
Next, download the Visual Studio bootstrapper file. To do so, choose the following button to go to the Visual Studio download page. Choose the Download button, then you can select the edition of Visual Studio that you want.
Step 3 - Install the Visual Studio installer
Run the bootstrapper file you downloaded to install the Visual Studio Installer. This new lightweight installer includes everything you need to both install and customize Visual Studio.
From your Downloads folder, double-click the bootstrapper that matches or is similar to one of the following files:
- vs_community.exe for Visual Studio Community
- vs_professional.exe for Visual Studio Professional
- vs_enterprise.exe for Visual Studio Enterprise
If you receive a User Account Control notice, choose Yes to allow the bootstrapper to run.
We'll ask you to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement. Choose Continue.
Step 4 - Choose workloads
After the installer is installed, you can use it to customize your installation by selecting the workloads, or feature sets, that you want. Here's how.
Find the workload you want in the Installing Visual Studio screen.
For core C and C++ support, choose the "Desktop development with C++" workload. It comes with the default core editor, which includes basic code editing support for over 20 languages, the ability to open and edit code from any folder without requiring a project, and integrated source code control.
Additional workloads support other kinds of development. For example, choose the "Universal Windows Platform development" workload to create apps that use the Windows Runtime for the Microsoft Store. Choose "Game development with C++" to create games that use DirectX, Unreal, and Cocos2d. Choose "Linux development with C++" to target Linux platforms, including IoT development.
The Installation details pane lists the included and optional components installed by each workload. You can select or deselect optional components in this list. For example, to support development by using the Visual Studio 2017 or 2015 compiler toolsets, choose the MSVC v141 or MSVC v140 optional components. You can add support for MFC, the experimental Modules language extension, IncrediBuild, and more.
After you choose the workload(s) and optional components you want, choose Install.
Next, status screens appear that show the progress of your Visual Studio installation.
At any time after installation, you can install workloads or components that you didn't install initially. If you have Visual Studio open, go to Tools > Get Tools and Features. which opens the Visual Studio Installer. Or, open Visual Studio Installer from the Start menu. From there, you can choose the workloads or components that you wish to install. Then, choose Modify.
Step 5 - Choose individual components (Optional)
If you don't want to use the Workloads feature to customize your Visual Studio installation, or you want to add more components than a workload installs, you can do so by installing or adding individual components from the Individual components tab. Choose what you want, and then follow the prompts.
Step 6 - Install language packs (Optional)
By default, the installer program tries to match the language of the operating system when it runs for the first time. To install Visual Studio in a language of your choosing, choose the Language packs tab from the Visual Studio Installer, and then follow the prompts.
Change the installer language from the command line
Another way that you can change the default language is by running the installer from the command line. For example, you can force the installer to run in English by using the following command: vs_installer.exe --locale en-US . The installer will remember this setting when it's run the next time. The installer supports the following language tokens: zh-cn, zh-tw, cs-cz, en-us, es-es, fr-fr, de-de, it-it, ja-jp, ko-kr, pl-pl, pt-br, ru-ru, and tr-tr.
Step 7 - Change the installation location (Optional)
You can reduce the installation footprint of Visual Studio on your system drive. You can choose to move the download cache, shared components, SDKs, and tools to different drives, and keep Visual Studio on the drive that runs it the fastest.
You can select a different drive only when you first install Visual Studio. If you've already installed it and want to change drives, you must uninstall Visual Studio and then reinstall it.
Step 8 - Start developing
After Visual Studio installation is complete, choose the Launch button to get started developing with Visual Studio.
On the start window, choose Create a new project.
In the search box, enter the type of app you want to create to see a list of available templates. The list of templates depends on the workload(s) that you chose during installation. To see different templates, choose different workloads.
You can also filter your search for a specific programming language by using the Language drop-down list. You can filter by using the Platform list and the Project type list, too.
Visual Studio opens your new project, and you're ready to code!
Visual Studio 2017 Installation
In Visual Studio 2017, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Prerequisites
A broadband internet connection. The Visual Studio installer can download several gigabytes of data.
A computer that runs Microsoft Windows 7 or later versions. We recommend the latest version of Windows for the best development experience. Make sure that the latest updates are applied to your system before you install Visual Studio.
Enough free disk space. Visual Studio requires at least 7 GB of disk space, and can take 50 GB or more if many common options are installed. We recommend you install it on your C: drive.
For details on the disk space and operating system requirements, see Visual Studio Product Family System Requirements. The installer reports how much disk space is required for the options you select.
Download and install
To download the latest Visual Studio 2017 installer for Windows, go to the Microsoft Visual Studio Older downloads page. Expand the 2017 section, and choose the Download button.
The Community edition is for individual developers, classroom learning, academic research, and open source development. For other uses, install Visual Studio 2017 Professional or Visual Studio 2017 Enterprise.
Find the installer file you downloaded and run it. The downloaded file may be displayed in your browser, or you may find it in your Downloads folder. The installer needs Administrator privileges to run. You may see a User Account Control dialog asking you to give permission to let the installer make changes to your system; choose Yes. If you're having trouble, find the downloaded file in File Explorer, right-click on the installer icon, and choose Run as Administrator from the context menu.
The installer presents you with a list of workloads, which are groups of related options for specific development areas. Support for C++ is now part of optional workloads that aren't installed by default.
For C and C++, select the Desktop development with C++ workload and then choose Install.
When the installation completes, choose the Launch button to start Visual Studio.
The first time you run Visual Studio, you're asked to sign in with a Microsoft Account. If you don't have one, you can create one for free. You must also choose a theme. Don't worry, you can change it later if you want to.
It may take Visual Studio several minutes to get ready for use the first time you run it. Here's what it looks like in a quick time-lapse:
Visual Studio starts much faster when you run it again.
When Visual Studio opens, check to see if the flag icon in the title bar is highlighted:
If it's highlighted, select it to open the Notifications window. If there are any updates available for Visual Studio, we recommend you install them now. Once the installation is complete, restart Visual Studio.
Visual Studio 2015 Installation
To install Visual Studio 2015, go to the Microsoft Visual Studio Older downloads page. Expand the 2015 section, and choose the Download button. Run the downloaded setup program and choose Custom installation and then choose the C++ component. To add C and C++ support to an existing Visual Studio 2015 installation, click on the Windows Start button and type Add Remove Programs. Open the program from the results list and then find your Visual Studio 2015 installation in the list of installed programs. Double-click it, then choose Modify and select the Visual C++ components to install.
In general, we highly recommend that you use the latest version of Visual Studio even if you need to compile your code using the Visual Studio 2015 compiler. For more information, see Use native multi-targeting in Visual Studio to build old projects.
When Visual Studio is running, you're ready to continue to the next step.
Visual Studio можно использовать для создания стандартных программ на языке C++. Выполнив действия, описанные в этом пошаговом руководстве, можно создать проект, добавить новый файл в проект, изменить файл для добавления кода C++, а затем скомпилировать и запустить программу с помощью Visual Studio.
Можно ввести собственную программу на языке C++ или использовать один из примеров программ. Примером программы в этом пошаговом руководстве является консольное приложение. Это приложение использует set контейнер в стандартной библиотеке C++.
Если требуется соответствие определенной версии стандарта языка C++ (например, C++ 14, C++ 17 или C++ 20), используйте /std:c++14 параметр компилятора, /std:c++17 или /std:c++20 . (Visual Studio 2017 и более поздних версий.)
Предварительные требования
Для выполнения этого пошагового руководства читатель должен владеть основами языка C++.
Создание проекта и Добавление исходного файла
Приведенные ниже инструкции немного отличаются в зависимости от используемой версии Visual Studio. Чтобы ознакомиться с документацией по предпочтительной версии Visual Studio, используйте селектор Версия. Он находится в верхней части оглавления на этой странице.
Создание проекта C++ в Visual Studio
В главном меню выберите Файл >Создать >Проект, чтобы открыть диалоговое окно Создание проекта.
В верхней части диалогового окна задайте для параметра Язык значение C++, для параметра Платформа значение Windows, а для Типа проекта — Консоль.
В отфильтрованном списке типов проектов щелкните Консольное приложение, а затем нажмите кнопку Далее. На следующей странице введите имя проекта и при необходимости укажите расположение проекта.
создание проекта C++ в Visual Studio 2017
Создайте проект, наведя указатель на пункт создать в меню файл и выбрав пункт Project.
на панели типы проектов Visual C++ щелкните Windows рабочий стол, а затем выберите Windows консольное приложение.
Введите имя проекта. По умолчанию решение, содержащее проект, имеет то же имя, что и проект, но можно ввести другое имя. Можно также ввести другое расположение для проекта.
создание проекта C++ в Visual Studio 2015
Создайте проект, наведя указатель на пункт создать в меню файл и выбрав пункт Project.
на панели типы проектов Visual C++ щелкните Windows рабочий стол, а затем выберите Windows консольное приложение.
в диалоговом окне создание Project разверните узел установленные>шаблоны>Visual C++, а затем выберите Win32. В центральной области выберите Консольное приложение Win32.
Введите имя проекта. По умолчанию решение, содержащее проект, имеет то же имя, что и проект, но можно ввести другое имя. Можно также ввести другое расположение для проекта.
Завершите работу мастера приложений Win32.
Добавить новый исходный файл
если Обозреватель решений не отображается, в меню вид выберите пункт Обозреватель решений.
Добавьте в проект новый исходный файл, как показано ниже.
в Обозреватель решенийщелкните правой кнопкой мыши папку исходные файлы , наведите указатель на пункт добавитьи выберите пункт новый элемент.
В узле код щелкните файл C++ (. cpp), введите имя файла и нажмите кнопку добавить.
cpp-файл появится в папке исходные файлы в Обозреватель решений, а файл откроется в редакторе Visual Studio.
В файле в редакторе введите допустимую программу на языке C++, которая использует стандартную библиотеку C++, или скопируйте один из примеров программ и вставьте его в файл.
В меню Сборка выберите Построить решение.
В меню Отладка выберите команду Запуск без отладки.
Если использовался пример программы, откроется окно командной строки, в котором будет указано, найдены ли в наборе определенные целые числа.
If you haven't downloaded and installed Visual Studio and the Microsoft C/C++ tools yet, here's how to get started.
Visual Studio 2022 Installation
Welcome to Visual Studio 2022! In this version, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Want to know more about what else is new in this version? See the Visual Studio release notes.
Ready to install? We'll walk you through it, step-by-step.
Step 1 - Make sure your computer is ready for Visual Studio
Before you begin installing Visual Studio:
Check the system requirements. These requirements help you know whether your computer supports Visual Studio 2022.
Apply the latest Windows updates. These updates ensure that your computer has both the latest security updates and the required system components for Visual Studio.
Reboot. The reboot ensures that any pending installs or updates don't hinder the Visual Studio install.
Free up space. Remove unneeded files and applications from your %SystemDrive% by, for example, running the Disk Cleanup app.
For questions about running previous versions of Visual Studio side by side with Visual Studio 2022, see the Visual Studio 2022 Platform Targeting and Compatibility page.
Step 2 - Download Visual Studio
Next, download the Visual Studio bootstrapper file. To do so, choose the following button to go to the Visual Studio download page. Select the edition of Visual Studio that you want and choose the Free trial or Free download button.
Step 3 - Install the Visual Studio installer
Run the bootstrapper file you downloaded to install the Visual Studio Installer. This new lightweight installer includes everything you need to both install and customize Visual Studio.
From your Downloads folder, double-click the bootstrapper that matches or is similar to one of the following files:
- vs_community.exe for Visual Studio Community
- vs_professional.exe for Visual Studio Professional
- vs_enterprise.exe for Visual Studio Enterprise
If you receive a User Account Control notice, choose Yes to allow the bootstrapper to run.
We'll ask you to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement. Choose Continue.
Step 4 - Choose workloads
After the installer is installed, you can use it to customize your installation by selecting the workloads, or feature sets, that you want. Here's how.
Find the workload you want in the Installing Visual Studio screen.
For core C and C++ support, choose the "Desktop development with C++" workload. It comes with the default core editor, which includes basic code editing support for over 20 languages, the ability to open and edit code from any folder without requiring a project, and integrated source code control.
Additional workloads support other kinds of development. For example, choose the "Universal Windows Platform development" workload to create apps that use the Windows Runtime for the Microsoft Store. Choose "Game development with C++" to create games that use DirectX, Unreal, and Cocos2d. Choose "Linux development with C++" to target Linux platforms, including IoT development.
The Installation details pane lists the included and optional components installed by each workload. You can select or deselect optional components in this list. For example, to support development by using the Visual Studio 2017 or 2015 compiler toolsets, choose the MSVC v141 or MSVC v140 optional components. You can add support for MFC, the experimental Modules language extension, IncrediBuild, and more.
After you choose the workload(s) and optional components you want, choose Install.
Next, status screens appear that show the progress of your Visual Studio installation.
At any time after installation, you can install workloads or components that you didn't install initially. If you have Visual Studio open, go to Tools > Get Tools and Features. which opens the Visual Studio Installer. Or, open Visual Studio Installer from the Start menu. From there, you can choose the workloads or components that you wish to install. Then, choose Modify.
Step 5 - Choose individual components (Optional)
If you don't want to use the Workloads feature to customize your Visual Studio installation, or you want to add more components than a workload installs, you can do so by installing or adding individual components from the Individual components tab. Choose what you want, and then follow the prompts.
Step 6 - Install language packs (Optional)
By default, the installer program tries to match the language of the operating system when it runs for the first time. To install Visual Studio in a language of your choosing, choose the Language packs tab from the Visual Studio Installer, and then follow the prompts.
Change the installer language from the command line
Another way that you can change the default language is by running the installer from the command line. For example, you can force the installer to run in English by using the following command: vs_installer.exe --locale en-US . The installer will remember this setting when it's run the next time. The installer supports the following language tokens: zh-cn, zh-tw, cs-cz, en-us, es-es, fr-fr, de-de, it-it, ja-jp, ko-kr, pl-pl, pt-br, ru-ru, and tr-tr.
Step 7 - Change the installation location (Optional)
You can reduce the installation footprint of Visual Studio on your system drive. You can choose to move the download cache, shared components, SDKs, and tools to different drives, and keep Visual Studio on the drive that runs it the fastest.
You can select a different drive only when you first install Visual Studio. If you've already installed it and want to change drives, you must uninstall Visual Studio and then reinstall it.
Step 8 - Start developing
After Visual Studio installation is complete, choose the Launch button to get started developing with Visual Studio.
On the start window, choose Create a new project.
In the search box, enter the type of app you want to create to see a list of available templates. The list of templates depends on the workload(s) that you chose during installation. To see different templates, choose different workloads.
You can also filter your search for a specific programming language by using the Language drop-down list. You can filter by using the Platform list and the Project type list, too.
Visual Studio opens your new project, and you're ready to code!
Visual Studio 2019 Installation
Welcome to Visual Studio 2019! In this version, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Want to know more about what else is new in this version? See the Visual Studio release notes.
Ready to install? We'll walk you through it, step-by-step.
Step 1 - Make sure your computer is ready for Visual Studio
Before you begin installing Visual Studio:
Check the system requirements. These requirements help you know whether your computer supports Visual Studio 2019.
Apply the latest Windows updates. These updates ensure that your computer has both the latest security updates and the required system components for Visual Studio.
Reboot. The reboot ensures that any pending installs or updates don't hinder the Visual Studio install.
Free up space. Remove unneeded files and applications from your %SystemDrive% by, for example, running the Disk Cleanup app.
For questions about running previous versions of Visual Studio side by side with Visual Studio 2019, see the Visual Studio 2019 Platform Targeting and Compatibility page.
Step 2 - Download Visual Studio
Next, download the Visual Studio bootstrapper file. To do so, choose the following button to go to the Visual Studio download page. Choose the Download button, then you can select the edition of Visual Studio that you want.
Step 3 - Install the Visual Studio installer
Run the bootstrapper file you downloaded to install the Visual Studio Installer. This new lightweight installer includes everything you need to both install and customize Visual Studio.
From your Downloads folder, double-click the bootstrapper that matches or is similar to one of the following files:
- vs_community.exe for Visual Studio Community
- vs_professional.exe for Visual Studio Professional
- vs_enterprise.exe for Visual Studio Enterprise
If you receive a User Account Control notice, choose Yes to allow the bootstrapper to run.
We'll ask you to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement. Choose Continue.
Step 4 - Choose workloads
After the installer is installed, you can use it to customize your installation by selecting the workloads, or feature sets, that you want. Here's how.
Find the workload you want in the Installing Visual Studio screen.
For core C and C++ support, choose the "Desktop development with C++" workload. It comes with the default core editor, which includes basic code editing support for over 20 languages, the ability to open and edit code from any folder without requiring a project, and integrated source code control.
Additional workloads support other kinds of development. For example, choose the "Universal Windows Platform development" workload to create apps that use the Windows Runtime for the Microsoft Store. Choose "Game development with C++" to create games that use DirectX, Unreal, and Cocos2d. Choose "Linux development with C++" to target Linux platforms, including IoT development.
The Installation details pane lists the included and optional components installed by each workload. You can select or deselect optional components in this list. For example, to support development by using the Visual Studio 2017 or 2015 compiler toolsets, choose the MSVC v141 or MSVC v140 optional components. You can add support for MFC, the experimental Modules language extension, IncrediBuild, and more.
After you choose the workload(s) and optional components you want, choose Install.
Next, status screens appear that show the progress of your Visual Studio installation.
At any time after installation, you can install workloads or components that you didn't install initially. If you have Visual Studio open, go to Tools > Get Tools and Features. which opens the Visual Studio Installer. Or, open Visual Studio Installer from the Start menu. From there, you can choose the workloads or components that you wish to install. Then, choose Modify.
Step 5 - Choose individual components (Optional)
If you don't want to use the Workloads feature to customize your Visual Studio installation, or you want to add more components than a workload installs, you can do so by installing or adding individual components from the Individual components tab. Choose what you want, and then follow the prompts.
Step 6 - Install language packs (Optional)
By default, the installer program tries to match the language of the operating system when it runs for the first time. To install Visual Studio in a language of your choosing, choose the Language packs tab from the Visual Studio Installer, and then follow the prompts.
Change the installer language from the command line
Another way that you can change the default language is by running the installer from the command line. For example, you can force the installer to run in English by using the following command: vs_installer.exe --locale en-US . The installer will remember this setting when it's run the next time. The installer supports the following language tokens: zh-cn, zh-tw, cs-cz, en-us, es-es, fr-fr, de-de, it-it, ja-jp, ko-kr, pl-pl, pt-br, ru-ru, and tr-tr.
Step 7 - Change the installation location (Optional)
You can reduce the installation footprint of Visual Studio on your system drive. You can choose to move the download cache, shared components, SDKs, and tools to different drives, and keep Visual Studio on the drive that runs it the fastest.
You can select a different drive only when you first install Visual Studio. If you've already installed it and want to change drives, you must uninstall Visual Studio and then reinstall it.
Step 8 - Start developing
After Visual Studio installation is complete, choose the Launch button to get started developing with Visual Studio.
On the start window, choose Create a new project.
In the search box, enter the type of app you want to create to see a list of available templates. The list of templates depends on the workload(s) that you chose during installation. To see different templates, choose different workloads.
You can also filter your search for a specific programming language by using the Language drop-down list. You can filter by using the Platform list and the Project type list, too.
Visual Studio opens your new project, and you're ready to code!
Visual Studio 2017 Installation
In Visual Studio 2017, it's easy to choose and install just the features you need. And because of its reduced minimum footprint, it installs quickly and with less system impact.
Prerequisites
A broadband internet connection. The Visual Studio installer can download several gigabytes of data.
A computer that runs Microsoft Windows 7 or later versions. We recommend the latest version of Windows for the best development experience. Make sure that the latest updates are applied to your system before you install Visual Studio.
Enough free disk space. Visual Studio requires at least 7 GB of disk space, and can take 50 GB or more if many common options are installed. We recommend you install it on your C: drive.
For details on the disk space and operating system requirements, see Visual Studio Product Family System Requirements. The installer reports how much disk space is required for the options you select.
Download and install
To download the latest Visual Studio 2017 installer for Windows, go to the Microsoft Visual Studio Older downloads page. Expand the 2017 section, and choose the Download button.
The Community edition is for individual developers, classroom learning, academic research, and open source development. For other uses, install Visual Studio 2017 Professional or Visual Studio 2017 Enterprise.
Find the installer file you downloaded and run it. The downloaded file may be displayed in your browser, or you may find it in your Downloads folder. The installer needs Administrator privileges to run. You may see a User Account Control dialog asking you to give permission to let the installer make changes to your system; choose Yes. If you're having trouble, find the downloaded file in File Explorer, right-click on the installer icon, and choose Run as Administrator from the context menu.
The installer presents you with a list of workloads, which are groups of related options for specific development areas. Support for C++ is now part of optional workloads that aren't installed by default.
For C and C++, select the Desktop development with C++ workload and then choose Install.
When the installation completes, choose the Launch button to start Visual Studio.
The first time you run Visual Studio, you're asked to sign in with a Microsoft Account. If you don't have one, you can create one for free. You must also choose a theme. Don't worry, you can change it later if you want to.
It may take Visual Studio several minutes to get ready for use the first time you run it. Here's what it looks like in a quick time-lapse:
Visual Studio starts much faster when you run it again.
When Visual Studio opens, check to see if the flag icon in the title bar is highlighted:
If it's highlighted, select it to open the Notifications window. If there are any updates available for Visual Studio, we recommend you install them now. Once the installation is complete, restart Visual Studio.
Visual Studio 2015 Installation
To install Visual Studio 2015, go to the Microsoft Visual Studio Older downloads page. Expand the 2015 section, and choose the Download button. Run the downloaded setup program and choose Custom installation and then choose the C++ component. To add C and C++ support to an existing Visual Studio 2015 installation, click on the Windows Start button and type Add Remove Programs. Open the program from the results list and then find your Visual Studio 2015 installation in the list of installed programs. Double-click it, then choose Modify and select the Visual C++ components to install.
In general, we highly recommend that you use the latest version of Visual Studio even if you need to compile your code using the Visual Studio 2015 compiler. For more information, see Use native multi-targeting in Visual Studio to build old projects.
When Visual Studio is running, you're ready to continue to the next step.
Команда Visual C++ рада сообщить, что в Visual Studio 2017 было существенно улучшено качество реализации модулей C++ согласно технической спецификации; также мы добавили возможность подключать Стандартную Библиотеку C++ через интерфейсы модулей. Эти интерфейсы, как и поддержка модулей компилятором, являются экспериментальной разработкой и будут развиваться в соответствии с процессом стандартизации.
Начало работы
Поддержка модулей Стандартной Библиотеки реализована в Visual Studio начиная с версии 2017 RTM. Эта функция на данный момент является опциональной и по умолчанию отключена. В будущих версиях модули будут устанавливаться автоматически вместе с заголовками Стандартной Библиотеки. Вам нужно лишь выбрать эту опцию при установке или обновлении поддержки C++.
Проверка правильности установки
Чтобы проверить, настроена ли ваша копия VS 2017 для поддержки модулей, скомпилируйте и запустите приведенную ниже программу (назовите ее, например, test-vs2017-slm.cxx) из командной строки разработчика. Поскольку модули на данный момент являются экспериментальной функцией, их поддержка пока еще очень слабо реализована в среде VS.
При компиляции этого кода с командой
на выходе должен получиться исполняемый файл (test-vs2017-slm.exe), который при запуске распечатает слова «Plato», «Descartes» и «Bacon» — каждое отдельной строкой.
Ключ компилятора для подключения модулей Стандартной Библиотеки
Необходимо добавить ключ /MD при компиляции исходного файла, чтобы подключить модули Стандартной Библиотеки. Ключ /MD инициализирует динамическую библиотеку времени выполнения C (CRT). В режиме отладки следует использовать ключ /MDd.
Если вы забыли указать ключ /MD (или /MDd в режиме отладки), линковщик выдаст ряд предупреждений и ошибку линковки LNK2019, говорящую о наличии неразрешенных внешних символов.
Никаких других ключей для использования модулей Стандартной Библиотеки не требуется. Эти модули могут применяться только для использования с библиотеками импорта DLL Универсальной библиотеки CRT (UCRT).
Подключение модулей Стандартной Библиотеки из среды разработки VS
Если вы хотите использовать среду разработки вместо командной строки, настройте ваш проект для использования экспериментальных модулей согласно следующей инструкции.
1. Откройте окно «Свойства» (Properties) проекта:
2. Перейдите в раздел «Свойства конфигурации» (Configuration Properties) -> C/C++ -> «Генерация кода» (Code Generation) и убедитесь, что у вас выбрана библиотека Multithreaded Debug DLL или Multithreaded DLL (для режимов отладки и релиза соответственно). Эти библиотеки выбраны по умолчанию для новых проектов, так что, если вы ничего не меняли, никаких проблем возникнуть не должно.
3. Зайдите в раздел «Свойства конфигурации» (Configuration Properties) -> C/C++ -> «Язык» (Language) и убедитесь, что включена поддержка стандарта C++17. Если это не так, выберите из выпадающего списка стандарт C++17 или последний проект стандарта C++ (C++ Latest Draft Standard) для конфигураций, которые вы планируете использовать.
4. Впишите команду /experimental:module /module:stdIfcDir "$(VCToolsInstallDir_150)ifc\$(PlatformTarget)" в разделе «Свойства конфигурации» (Configuration Properties) -> C/C++ -> «Командная строка» (Command Line), чтобы включить поддержку модулей для текущего проекта. Обратите внимание, что данный шаг будет упразднен в будущих версиях VS 2017: среда будет сама указывать расположение файлов модулей (задается параметром /module:stdIfcDir) при включении опции поддержки модулей C++.
После этих действий сборка и запуск тестовой программы должны пройти успешно — программа распечатает имена трех философов.
Изменение синтаксиса экспорта модулей
На съезде комитета по стандартизации C++ в ноябре 2016 года было принято решение об изменении синтаксиса экспорта модулей (см. Проблема модулей N1).
Настоящая версия Visual C++ учитывает это изменение, но также позволяет использовать и старый синтаксис, предупреждая о переходе к устаревшему варианту. Комитет по C++ рассматривает возможность присвоения старому синтаксису нового значения, несовместимого с прежним. Мы призываем вас использовать новый синтаксис; поддержка старого синтаксиса будет прекращена в целях соответствия проекту технической спецификации по модулям согласно поправкам комитета ISO C++.
Модули Стандартной Библиотеки (экспериментальная функция)
Ключевым нововведением в версии VS2017 RTM стала поддержка подключения Стандартной Библиотеки C++ посредством модулей. Это экспериментальный инструмент, описанный в предложении по C++ о Модулях Стандартной Библиотеки. В текущей версии модули организованы следующим образом:
- std.regex предоставляет доступ к содержимому заголовка
- std.filesystem предоставляет доступ к содержимому заголовка
- std.memory предоставляет доступ к содержимому заголовка
- std.threading предоставляет доступ к содержимому заголовков , , , , ,
- std.core предоставляет доступ к прочему содержимому Стандартной Библиотеки C++
Если вы хотите использовать модули для включения заголовков не из Стандартной Библиотеки, сгенерировать модули Стандартной Библиотеки можно с помощью ключей /module:name (см. исходную заметку по модулям C++) и /module:export. Если ваш проект зависит от других библиотек и вы хотите попробовать собрать код совсем без заголовков, упаковать заголовки из таких библиотек можно тем же самым способом.
Новые версии VS будут в большей степени соответствовать предложению по модулям Стандартной Библиотеки.
Призыв к действию
В заключение
О прочих проблемах, связанных с использованием среды MSVC в VS 2017, можно сообщить с помощью функции Сообщить о проблеме (Report a Problem) из установщика или из самой среды Visual Studio. Свои предложения оставляйте на сайте UserVoice. Спасибо!
Читайте также: