Перейти к содержимому

Как установить си на visual studio

  • автор:

Как писать на C в Visual Studio 2017?

Как установить язык C в Visual Studio 2017? Нужен именно C , а не C++ или C# . При установке просто нет обычного C .

введите сюда описание изображения

Компиляцией С и С++ в студии занимается один и тот же компилятор. Файлы с расширением .c автоматически компилируются как С код. Также это можно задать вручную посредством параметра /TC

user7860670's user avatar

Если хочется писать на чистом си, при этом не особо хочется устанавливать большие пакеты студии, можно воспользоваться компилятором+IDE Pelles C — маленький, легенький, поддерживает с99, можно писать консольные и оконные приложения.

Дизайн сайта / логотип © 2023 Stack Exchange Inc; пользовательские материалы лицензированы в соответствии с CC BY-SA . rev 2023.9.7.43618

Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.

How to Install C and C++ support in Visual Studio

An IDE is a coding environment that includes both an editor and a language-specific toolchain. It also contains many other features to support many aspects of software development. Today, we will talk about Visual Studio IDE and how to install it and Microsoft C/C++ tools.

You can use Visual Studio IDE to edit, debug, build code, publish an app. And Visual Studio is not just a normal IDE, with normal features like editor and debugger, it can provide your more than that such as compilers, code completion tools, graphical designers, etc. to enhance the software development process. Now, let’s get started.

Visual Studio 2022 Installation

This article is only about how you can install Visual Studio 2022 on Windows. If you want to know the instruction for Mac, please see Install Visual Studio for Mac.

Step 1 — Check your system if it is ready for Visual Studio

Before installing Visual Studio on your PC, you will need to reboot your PC to make sure there’s no pending installs or updates that hinder the installation of Visual Studio. Then, you should check some of the information below:

        • System requirement to know if your PC support Visual Studio 2022.
        • Latest Windows updatesto ensure your PC has latest security updates and system requirement for Visual Studio.
        • Free up spaceby running the Disk Cleanup app to remove unnecessary files from your %SystemDrive%.

        Step 2 — Download Visual Studio

        In this step, we download the bootstrapper file of Visual Studio. You should go to Visual Studio download page, select the edition you need and click the Free trial or Free download button.

        Step 3 — Install the Visual Studio installer.

        Now you should find the bootstrapper file of Visual Studio you have downloaded then install it. It will install on your PC a lightweight installer which contains everything you need.

        First, you double click the bootstrapper that matches or is similar to one of the following files:

              • vs_community.exefor Visual Studio Community
              • vs_community.exefor Visual Studio Professional
              • vs_community.exefor Visual Studio Enterprise

              Then you will receive a User Account Control notice. Please click Yes to run the bootstrapper.

              Choose Continue if it asks you to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement.

              Step 4 — Choose workloads

              Once you installed the installer of Visual Studio, you can select the workloads and feature sets that you want. Let’s see how you do it.

              Below is the Installing Visual Studio screen you will find the workload on it.

              Source: docs.microsoft.com

              For core C and C++ support, choose Workloads menu > Desktop development with C++ (the third one). It will show you details on the right side of screen. You can select or deselect optional components in this list.

              You can see that it has other workloads support other kinds of development, like the Universal Windows Platform development, Mobile development with C++, etc.

              After you choose the workload(s) and optional components you want, choose Install.

              Before that, there are some optional installation you can set up:

              Choose individual components (Optional)

              There’s a case when you want to add more components than what is available in workload installs list, you can do so by using the Individual components tab. You can install and add individual components that you need, and follow the prompts.

              Install language packs (Optional)

              When running for the first time, the installer program will match the language of your OS. If you want to change the language of Visual Studio, choose Language packs > select language you want, then follow the prompts.

              Source: docs.microsoft.com

              Change the installation location (Optional)

              If you install Visual Studio and its stuffs on one drive, it will be heavy. You can reduce it by install Visual Studio on one drive runs it the fastest, and move the download cache, shared components, SDKs, and tools to different drives.

              Step 5 — Start developing

              After completing installation of Visual Studio, you can now choose Launch to start developing.

              To start a new project, choose “Create a new project“. Then you type the app you want to create in the search box and select a template.

              Now Visual Studio will open a new project for you, and you can code.

              Start your project in C++ and Visual Studio now with iRender

              Above is the guideline on how to install C and C++ support for Visual Studio. You can follow and do it on your PC, or on our Windows server.

              At iRender, we are proud to be one of the few who provides multiple GPUs for renting with state-of-the-art RTX3090. Our remote machines are Optimized for Scientific Computing, Machine Learning, Deep Learning with Windows and Linux OS.

              We support many programming language including C/C++ and IDE like Visual Studio. You can install them on our server, then start to develop your program now.

              This is our packages tailored for AI/ Deep Learning:

              best paid IDEs for C++ 5

              You can also read our article about how RTX3090 be the best choice for AI/ Deep Learning (Is RTX3090 the best GPU for Deep Learning).

              Moreover than that, we provide other features like NVLink if you need more VRAM, Gpuhub Sync to transfer and sync files faster, Fixed Rental feature to save credits from 10-20% compared to hourly rental (10% for daily rental, 20% for weekly and monthly rental).

              You can register an account today to experience our service. Or contact us via WhatsApp: (+84) 916806116 for advice and support.

              Среды разработки для С

              Одной из распространенных сред разработки для программирования на Windows является Visual Studio . В данном случае мы будем использовать бесплатную и полнофункциональную среду Visual Studio 2019 Community, которую можно найти по адресу https://visualstudio.microsoft.com/ru/vs/community/.

              После загрузки и запуска установщика Visual Studio в нем необходимо отметить пункт Разработка классических приложений на C++ :

              Установка С++ в Visual Studio

              Выбрав все необходимые пункты, нажмем ОК для запуска установки. После установки Visual Studio создадим первый проект. Для этого откроем Visual Studio. На стартовом экране выберем тип Empty Project для языка C++:

              Первый проект на Си в Visual Studio

              На следующем экране в поле для имени проекта дадим проекту имя HelloApp и также можно указать расположение проекта. И затем нажмем на Create для создания проекта.

              Первый проект на Си в Visual Studio

              После этого Visual Studio создаст пустой проект. Добавим в него текстовый файл для набора исходного кода. Для этого в окне Solution Explorer (Обозреватель решений) нажмем правой кнопкой мыши на узел Source Files и в контекстом меню выберем Add -> New Item. :

              Добавление файла на Си в Visual Studio

              Затем нам откроется окно для добавления нового элемента:

              Добавление исходного файла на Си в Visual Studio

              Здесь нам надо выбрать пункт C++ File(.cpp) , а внизу окна укажем для файла имя hello.c . Как правило, исходные файлы на Си имеют расширение .с . Оно указывает, что этот файл содержит исходный код на языке С, и он будет обрабатываться соответствующим компилятором.

              Настройка проекта

              После добавления файла изменим опции проекта. Для этого перейдем к пункту меню Project -> Properties

              Свойства проекта на Си в Visual Studio

              В окне свойств проекта в левой части перейдем к секции С/С++ и далее к пункту Advanced :

              Установка компилятора для языка Си в VS

              В правой части окна для поля Compile As установим значение Compile as C Code (/TC) . Тем самым мы говорим, чтобы по умолчанию исходный код компилировался именно как код С, а не С++.

              После установки этого значения нажмем на кнопку «Применить», чтобы новые настройки конфигурации вступили в силу.

              Для работы с языком Си может быть полезна еще одна настройка — установка стандарта языка. Перейдем к пункту С/С++ -> Language . Здесь в поле C Language Standard мы можем установить один из доступных стандартов для языка Си, который будет применяться для компиляции:

              Настройка стандарта языка Си в Visual Studio

              Правда, в данном случае он не играет значения, поэтому оставим для этого параметра настройку по умолчанию.

              Определение кода программы

              После добавления файла >hello.c проект будет иметь следующую структуру:

              Структура проекта на Си в Visual Studio

              Вкратце пробежимся по этой структуре. Окно Solution Explorer содержит в решение. В данном случае оно называется HelloApp. Решение может содержать несколько проектов. По умолчанию у нас один проект, который имеет то же имя — HelloApp. В проекте есть ряд узлов:

              External Dependencies : отображает файлы, которые используются в файлах исходного кода, но не являются частью проекта

              Header Files : предназначена для хранения заголовочных файлов с расширением .h

              Resource Files : предназначена для хранения файлов ресурсов, например, изображений

              Source Files : хранит файлы с исходным кодом

              Теперь определим в файле hello.c простейший код, который будет выводить строку на консоль:

              Здесь использован весь тот код, который был рассмотрен в предыдущих темах про компиляцию с помощью GCC.

              Теперь запустим программу. Для этого в Visual Studio нажмем на сочетание клавиш Ctrl+F5 или выберем пункт меню Debug -> Start Without Debugging :

              Запуск программы на Си в Visual Studio

              И в итоге Visual Studio передаст исходный код компилятору, который скомпилирует из кода исполняемый файл exe, который потом будет запущен на выполнение. И мы увидим на запущенной консоли наше сообщение:

              Первое приложение на языке программирования Си

              Затем в проекте в папке x64/Debug мы можем увидеть скомпилированный файл exe, который мы можем запускать независимо от Visual Studio:

              Как писать на C в Visual Studio 2017?

              Как установить язык C в Visual Studio 2017?
              Нужен именно C, а не C++ или C#. При установке просто нет обычного C.

              5bf6bcb83043f442592461.png

              • Вопрос задан более трёх лет назад
              • 8504 просмотра
              • Facebook
              • Вконтакте
              • Twitter

              А что делать,если в настройках все изменила, но после сборки выдает такую ошибку?
              5cb5cbbbab063292149329.png

              • Facebook
              • Вконтакте
              • Twitter

              Привет!
              Могу дать парочку советов о том, как писать в VS на си. (испытал уже на себе).
              1) Создаете пустой проект (не файл , а именно проект)
              2) Справа в обозревателе решений в папку *Исходные файлы* (Source files) создаете файл срр нажатием правой кнопки мыши.
              3) пишите в самом начале код #define _CRT_SECURE_NO_WARNINGS ( отключит оповещения об *небезопасном* использовании printf, scanf и тп.)
              4) обязательно подключайте библиотеку stdio.h
              5) вместо привычной задержки консоли getch() используйте _getche()

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *