# Compiling and Building
Programs written in C++ need to be compiled before they can be run. There is a large variety of compilers available depending on your operating system.
# Compiling with GCC
Assuming a single source file named main.cpp , the command to compile and link an non-optimized executable is as follows (Compiling without optimization is useful for initial development and debugging, although -Og
(opens new window) is officially recommended for newer GCC versions).
To produce an optimized executable for use in production, use one of the -O
If the -O option is omitted, -O0, which means no optimizations, is used as default (specifying -O without a number resolves to -O1).
Alternatively, use optimization flags from the O groups (or more experimental optimizations) directly. The following example builds with -O2 optimization, plus one flag from the -O3 optimization level:
To produce a platform-specific optimized executable (for use in production on the machine with the same architecture), use:
Either of the above will produce a binary file that can be run with .\app.exe on Windows and ./app on Linux, Mac OS, etc.
(opens new window) flag can also be skipped. In this case, GCC will create default output executable a.exe on Windows and a.out on Unix-like systems. To compile a file without linking it, use the -c
This produces an object file named file.o which can later be linked with other files to produce a binary:
More about optimization options can be found at gcc.gnu.org
(opens new window) . Of particular note are -Og (optimization with an emphasis on debugging experience — recommended for the standard edit-compile-debug cycle) and -Ofast (all optimizations, including ones disregarding strict standards compliance).
(opens new window) flag enables warnings for many common errors and should always be used. To improve code quality it is often encouraged also to use -Wextra
(opens new window) and other warning flags which are not automatically enabled by -Wall and -Wextra .
If the code expects a specific C++ standard, specify which standard to use by including the -std=
(opens new window) flag. Supported values correspond to the year of finalization for each version of the ISO C++ standard. As of GCC 6.1.0, valid values for the std= flag are c++98 / c++03 , c++11 , c++14 , and c++17 / c++1z . Values separated by a forward slash are equivalent.
GCC includes some compiler-specific extensions that are disabled when they conflict with a standard specified by the -std= flag. To compile with all extensions enabled, the value gnu++XX may be used, where XX is any of the years used by the c++ values listed above.
The default standard will be used if none is specified. For versions of GCC prior to 6.1.0, the default is -std=gnu++03 ; in GCC 6.1.0 and greater, the default is -std=gnu++14 .
Note that due to bugs in GCC, the -pthread flag must be present at compilation and linking for GCC to support the C++ standard threading functionality introduced with C++11, such as std::thread and std::wait_for . Omitting it when using threading functions may result in no warnings but invalid results
# Linking with libraries:
Use the -l option to pass the library name:
If the library is not in the standard library path, add the path with -L option:
Multiple libraries can be linked together:
If one library depends on another, put the dependent library before the independent library:
Or let the linker determine the ordering itself via —start-group and —end-group (note: this has significant performance cost):
# Compiling with Visual Studio (Graphical Interface) — Hello World
- Download and install Visual Studio Community 2015
You environment should look like: 
- Click Debug -> Start Without Debugging (or press ctrl + F5) :

# Online Compilers
Various websites provide online access to C++ compilers. Online compiler’s feature set vary significantly from site to site, but usually they allow to do the following:
- Paste your code into a web form in the browser.
- Select some compiler options and compile the code.
- Collect compiler and/or program output.
Online compiler website behavior is usually quite restrictive as they allow anyone to run compilers and execute arbitrary code on their server side, whereas ordinarily remote arbitrary code execution is considered as vulnerability.
Online compilers may be useful for the following purposes:
- Run a small code snippet from a machine which lacks C++ compiler (smartphones, tablets, etc.).
- Ensure that code compiles successfully with different compilers and runs the same way regardless the compiler it was compiled with.
- Learn or teach basics of C++.
- Learn modern C++ features (C++14 and C++17 in near future) when up-to-date C++ compiler is not available on local machine.
- Spot a bug in your compiler by comparison with a large set of other compilers. Check if a compiler bug was fixed in future versions, which are unavailable on your machine.
- Solve online judge problems.
What online compilers should not be used for:
- Develop full-featured (even small) applications using C++. Usually online compilers do not allow to link with third-party libraries or download build artifacts.
- Perform intensive computations. Sever-side computing resources are limited, so any user-provided program will be killed after a few seconds of execution. The permitted execution time is usually enough for testing and learning.
- Attack compiler server itself or any third-party hosts on the net.
Disclaimer: documentation author(s) are not affiliated with any resources listed below. Websites are listed alphabetically.
-
Online compiler with code sharing. Editing code after compiling with a source code warning or error does not work so well. Online compiler for which you specify the command line. Provides both GCC and Clang compilers for use. — Online compiler with C++14 support. Does not allow you to edit compiler command line, but some options are available via GUI controls. — Provides a wide list of compiler versions, architectures, and disassembly output. Very useful when you need to inspect what your code compiles into by different compilers. GCC, Clang, MSVC ( CL ), Intel compiler ( icc ), ELLCC, and Zapcc are present, with one or more of these compilers available for the ARM, ARMv8 (as ARM64), Atmel AVR, MIPS, MIPS64, MSP430, PowerPC, x86, and x64 architecutres. Compiler command line arguments may be edited. — Widely used on the Net to illustrate code snippet behavior. Provides both GCC and Clang for use, but doesn’t allow you to edit the compiler command line. — Supports numerous Clang and GNU/GCC compiler versions. — An extremely minimalistic IDE that includes an editor, a compiler (gcc), and a debugger (gdb). — Provides Clang, GCC, and Visual Studio compilers for both C and C++ (along with compilers for other languages), with the Boost library available for use. — Full-featured UNIX shell with GCC, and a user-friendly project explorer. — Online Visual Studio 2015 compiler, provided by Microsoft as part of RiSE4fun.
# Compiling with Visual C++ (Command Line)
For programmers coming from GCC or Clang to Visual Studio, or programmers more comfortable with the command line in general, you can use the Visual C++ compiler from the command line as well as the IDE.
If you desire to compile your code from the command line in Visual Studio, you first need to set up the command line environment. This can be done either by opening the Visual Studio Command Prompt / Developer Command Prompt / x86 Native Tools Command Prompt / x64 Native Tools Command Prompt or similar
(opens new window) (as provided by your version of Visual Studio), or at the command prompt, by navigating to the VC subdirectory of the compiler’s install directory (typically \Program Files (x86)\Microsoft Visual Studio x\VC , where x is the version number (such as 10.0 for 2010, or 14.0 for 2015) and running the VCVARSALL batch file with a command-line parameter specified here
Note that unlike GCC, Visual Studio doesn’t provide a front-end for the linker ( link.exe ) via the compiler ( cl.exe ), but instead provides the linker as a separate program, which the compiler calls as it exits. cl.exe and link.exe can be used separately with different files and options, or cl can be told to pass files and options to link if both tasks are done together. Any linking options specified to cl will be translated into options for link , and any files not processed by cl will be passed directly to link . As this is mainly a simple guide to compiling with the Visual Studio command line, arguments for link will not be described at this time; if you need a list, see here
Note that arguments to cl are case-sensitive, while arguments to link are not.
[Be advised that some of the following examples use the Windows shell "current directory" variable, %cd% , when specifying absolute path names. For anyone unfamiliar with this variable, it expands to the current working directory. From the command line, it will be the directory you were in when you ran cl , and is specified in the command prompt by default (if your command prompt is C:\src> , for example, then %cd% is C:\src\ ).]
Assuming a single source file named main.cpp in the current folder, the command to compile and link an unoptimised executable (useful for initial development and debugging) is (use either of the following):
Assuming an additional source file "niam.cpp" in the same directory, use the following:
You can also use wildcards, as one would expect:
To rename or relocate the executable, use one of the following:
Both /o and /Fe pass their parameter (let’s call it o-param ) to link as /OUT:o-param , appending the appropriate extension (generally .exe or .dll ) to "name" o-param s as necessary. While both /o and /Fe are to my knowledge identical in functionality, the latter is preferred for Visual Studio. /o is marked as deprecated, and appears to mainly be provided for programmers more familiar with GCC or Clang.
Note that while the space between /o and the specified folder and/or name is optional, there cannot be a space between /Fe and the specified folder and/or name.
Similarly, to produce an optimised executable (for use in production), use:
Finally, to produce a platform-specific optimized executable (for use in production on the machine with the specified architecture), choose the appropriate command prompt or VCVARSALL parameter
(opens new window) for the target platform. link should detect the desired platform from the object files; if not, use the /MACHINE option
(opens new window) to explicitly specify the target platform.
Any of the above will produce an executable with the name specified by /o or /Fe , or if neither is provided, with a name identical to the first source or object file specified to the compiler.
To compile a file(s) without linking, use:
This tells cl to exit without calling link , and produces an object file, which can later be linked with other files to produce a binary.
There are other valuable command line parameters as well, which it would be very useful for users to know:
For anyone more familiar with *nix systems and/or GCC/Clang, cl , link , and other Visual Studio command line tools can accept parameters specified with a hyphen (such as -c ) instead of a slash (such as /c ). Additionally, Windows recognises either a slash or a backslash as a valid path separator, so *nix-style paths can be used as well. This makes it easy to convert simple compiler command lines from g++ or clang++ to cl , or vice versa, with minimal changes.
Of course, when porting command lines that use more complex g++ or clang++ options, you need to look up equivalent commands in the applicable compiler documentations and/or on resource sites, but this makes it easier to get things started with minimal time spent learning about new compilers.
In case you need specific language features for your code, a specific release of MSVC was required. From Visual C++ 2015 Update 3
(opens new window) on it is possible to choose the version of the standard to compile with via the /std flag. Possible values are /std:c++14 and /std:c++latest ( /std:c++17 will follow soon).
Note: In older versions of this compiler, specific feature flags were available however this was mostly used for previews of new features.
# Compiling with Clang
(opens new window) front-end is designed for being compatible with GCC, most programs that can be compiled via GCC
(opens new window) will compile when you swap g++ by clang++ in the build scripts. If no -std=version is given, gnu11 will be used.
Windows users who are used to MSVC
(opens new window) can swap cl.exe with clang-cl.exe . By default, clang tries to be compatible with the highest version of MSVC that has been installed.
In the case of compiling with visual studio, clang-cl can be used by changing the Platform toolset in the project properties.
In both cases, clang is only compatible via its front-end, though it also tries to generate binary compatible object files. Users of clang-cl should note that the compatibility with MSVC is not complete yet
To use clang or clang-cl, one could use the default installation on certain Linux distributions or those bundled with IDEs (like XCode on Mac). For other versions of this compiler or on platforms which don’t have this installed, this can be download from the official download page
If you’re using CMake to build your code you can usually switch the compiler by setting the CC and CXX environment variables like this:
# The C++ compilation process
When you develop a C++ program, the next step is to compile the program before running it. The compilation is the process which converts the program written in human readable language like C, C++ etc into a machine code, directly understood by the Central Processing Unit. For example, if you have a C++ source code file named prog.cpp and you execute the compile command,
There are 4 main stages involved in creating an executable file from the source file.
The expanded C++ source code file produced by the C++ preprocessor is compiled into the assembly language for the platform.
The assembler code generated by the compiler is assembled into the object code for the platform.
The object code file produced by the assembler is linked together
with the object code files for any library functions used to produce either a library or an executable file.
Preprocessing
The preprocessor handles the preprocessor directives, like #include and #define. It is agnostic of the syntax of C++, which is why it must be used with care.
It works on one C++ source file at a time by replacing #include directives with the content of the respective files (which is usually just declarations), doing replacement of macros (#define), and selecting different portions of text depending of #if, #ifdef and #ifndef directives.
The preprocessor works on a stream of preprocessing tokens. Macro substitution is defined as replacing tokens with other tokens (the operator ## enables merging two tokens when it make sense).
After all this, the preprocessor produces a single output that is a stream of tokens resulting from the transformations described above. It also adds some special markers that tell the compiler where each line came from so that it can use those to produce sensible error messages.
Some errors can be produced at this stage with clever use of the #if and #error directives.
By using below compiler flag, we can stop the process at preprocessing stage.
Compilation
The compilation step is performed on each output of the preprocessor. The compiler parses the pure C++ source code (now without any preprocessor directives) and converts it into assembly code. Then invokes underlying back-end(assembler in toolchain) that assembles that code into machine code producing actual binary file in some format(ELF, COFF, a.out, . ). This object file contains the compiled code (in binary form) of the symbols defined in the input. Symbols in object files are referred to by name.
Object files can refer to symbols that are not defined. This is the case when you use a declaration, and don’t provide a definition for it. The compiler doesn’t mind this, and will happily produce the object file as long as the source code is well-formed.
Compilers usually let you stop compilation at this point. This is very useful because with it you can compile each source code file separately. The advantage this provides is that you don’t need to recompile everything if you only change a single file.
The produced object files can be put in special archives called static libraries, for easier reusing later on.
It’s at this stage that "regular" compiler errors, like syntax errors or failed overload resolution errors, are reported.
In order to stop the process after the compile step, we can use the -S option:
Assembling
The assembler creates object code. On a UNIX system you may see files with a .o suffix (.OBJ on MSDOS) to indicate object code files. In this phase the assembler converts those object files from assembly code into machine level instructions and the file created is a relocatable object code. Hence, the compilation phase generates the relocatable object program and this program can be used in different places without having to compile again.
To stop the process after the assembly step, you can use the -c option:
Linking
The linker is what produces the final compilation output from the object files the assembler produced. This output can be either a shared (or dynamic) library (and while the name is similar, they don’t have much in common with static libraries mentioned earlier) or an executable.
It links all the object files by replacing the references to undefined symbols with the correct addresses. Each of these symbols can be defined in other object files or in libraries. If they are defined in libraries other than the standard library, you need to tell the linker about them.
At this stage the most common errors are missing definitions or duplicate definitions. The former means that either the definitions don’t exist (i.e. they are not written), or that the object files or libraries where they reside were not given to the linker. The latter is obvious: the same symbol was defined in two different object files or libraries.
# Compiling with Code::Blocks (Graphical interface)
# Remarks
Most operating systems ship without a compiler, and they have to be installed later. Some common compilers choices are:
-
g++clang++visual-c++ (included in RAD Studio) c++builder
Please consult the appropriate compiler manual, on how to compile a C++ program.
Another option to use a specific compiler with its own specific build system, it is possible to let generic build systems
(opens new window) configure the project for a specific compiler or for the default installed one.
Microsoft C++ versions explained
Microsoft has five different version numbers to think about when it comes to C++. Here’s an attempt to explain what they all mean.
- Visual Studio release year (the “marketing version number”), e.g. Visual Studio 2022
- Visual Studio actual version number, e.g. Visual Studio 17.0
- Visual C++ (MSVC) version, e.g. MSVC 14.30
- Toolset version, e.g. toolset 143
- Compiler version, e.g. cl.exe 19.30
Visual Studio versions
What most people will see first is the Visual Studio release year. You’ll download Visual Studio 2022, Visual Studio 2019 etc. These however also have a more normal major.minor versioning scheme, and they bump the major version for every release year. So for instance VS 2017 is version 15, VS 2019 is version 16, and VS 2022 is version 17. Note that the year and the major version are not correlated in any way, except that Visual Studio 2010 just happened to also be version 10.
Visual Studio also has minor releases of each major version. Some examples (there are more minor releases per major than shown here):
| Year | version |
|---|---|
| Visual Studio 2017 | 15.0 |
| 15.3 | |
| Visual Studio 2019 | 16.0 |
| 16.1 | |
| Visual Studio 2022 | 17.0 |
| 17.1 |
Visual C++ versions
Microsoft Visual C++, aka MSVC, ships as a part of Visual Studio, but has its own versioning scheme. Importantly, the major number signifies ABI compatibility, so something compiled with MSVC at one major version number can be linked against something compiled with any other MSVC at the same major version. (Some restrictions apply.) The MSVC major version number luckily gets bumped a lot less often than the Visual Studio version itself. As of Visual Studio 2015, they have kept the MSVC major version at 14. The first digit of the minor version seems to be bumped for each major version of Visual Studio itself. The Visual C++ version number is also used for the Visual C++ Redistributable.
| VS Year | VS version | MSVC version |
|---|---|---|
| Visual Studio 2017 | 15.0 | 14.1 |
| 15.3 | 14.11 | |
| Visual Studio 2019 | 16.0 | 14.20 |
| 16.1 | 14.21 | |
| Visual Studio 2022 | 17.0 | 14.30 |
| 17.1 | 14.31 |
The linker ( link.exe ) also uses the Visual C++ version number as its version number, so e.g. for Visual C++ 14.32 I might see link.exe version 14.32.31332.0 .
C++ toolset versions
Closely related to the MSVC version number is the C++ toolset version number. I can’t find a good source for it, but from Microsoft’s article it seems that the toolset version is made up of the MSVC major version and the first digit of the MSVC minor version. Some examples:
| VS Year | VS version | MSVC version | Toolset version |
|---|---|---|---|
| Visual Studio 2017 | 15.0 | 14.1 | 141 |
| 15.3 | 14.11 | 141 | |
| Visual Studio 2019 | 16.0 | 14.20 | 142 |
| 16.1 | 14.21 | 142 | |
| Visual Studio 2022 | 17.0 | 14.30 | 143 |
| 17.1 | 14.31 | 143 |
Compiler versions
Finally, there’s the compiler version, which is what cl.exe reports. E.g. 19.16.27048 . The major.minor version scheme correlates with the _MSC_VER macro which you can check in your source code (godbolt). So e.g. cl.exe version 19.21 has _MSC_VER 1921. (I’ll be nice and count those as one version number.)
| VS Year | VS version | MSVC version | Toolset version | Compiler version |
|---|---|---|---|---|
| Visual Studio 2017 | 15.0 | 14.1 | 141 | 19.10 |
| 15.3 | 14.11 | 141 | 19.11 | |
| Visual Studio 2019 | 16.0 | 14.20 | 142 | 19.20 |
| 16.1 | 14.21 | 142 | 19.21 | |
| Visual Studio 2022 | 17.0 | 14.30 | 143 | 19.30 |
| 17.1 | 14.31 | 143 | 19.31 |
The _MSC_VER version number is incremented monotonically at each Visual C++ toolset update, so if you want to only compile some stuff if the compiler is new enough, you can do e.g. #if _MSC_VER >= 1930 .
Appendix: Running out of version numbers
Interestingly, the scheme where they bump the first digit of the Visual C++ minor version for each major release of Visual Studio means that they can only have nine minor versions of MSVC per Visual Studio major version! And looking at wikipedia, it seems they actually ran out of toolset versions at the end of Visual Studio 2019 and reused 14.28 and 14.29 for the final four Visual Studio 2019 releases (Visual Studio 16.8 and 16.9 had MSVC 14.28, Visual Studio 16.10 and 16.11 had MSVC 14.29).
How to Write And Run C and C++ Code in Visual Studio Code

Md. Fahim Bin Amin

Visual Studio Code (or VS Code for short) is a very common and widely used text editor and IDE (Integrated Development Environment). You can make VS Code very powerful like an IDE using a lot of extensions.
Before approaching the process of running your first C or C++ code on Visual Studio Code, let me guide you through the process and get it all set up based on the operating system you are using on your computer.
C and C++ compilers
For running C or C++ code, you just need to have a valid C/C++ compiler installed on your computer. If you are using a Linux operating system, then there is a high chance that it is already installed on your system. But we need to make sure that it is correctly installed.
For checking whether or not you have the compiler (GCC/G++/MinGW) installed on your system or not, you have to check the compiler version first.
Simply open your terminal and use gcc —version and g++ —version . If you get the version number, then the compiler is already installed on your system.
You can check the version using the same commands on any operating system, whether that is a Windows, Linux, or macOS-based operating system.
If you get feedback on your terminal that it does not know anything about GCC or G++, then you have to install the compiler correctly.
If you are using the most used Windows operating system, then I already have written an in-depth article showing you all the processes step-by-step on freeCodeCamp. Make sure to read the entire article first, as it also contains a complete video to provide you with complete support.
If you are using another operating system, and you don’t have the compilers installed, then make sure to install them before proceeding.
How to Install VS Code or VS Code Insiders
You have to download Visual Studio Code directly from the official website: https://code.visualstudio.com/.
If you want, you can also install VS Code Insiders, and the same process is applicable for that as well.
Visual Studio Code Insiders is actually the «Insiders» build of Visual Studio Code, which contains all the latest features that are shipped daily. You can think of VS Code as the stable release and the VS Code Insiders as the Insiders release of that.
If you want to experience the latest updates instantly, then you might also try Visual Studio Code Insiders (I use it myself). For downloading VS Code Insiders, you can visit the official website for VS Code Insiders here: https://code.visualstudio.com/insiders/
Make sure to download the exact file for your operating system.
Download Page: VS Code
Download Page: VS Code Insiders
The installation process is pretty basic. But I am going to show you all the steps sequentially. For now, I am going to show you the installation process using VS Code Insiders, but everything you will see here is going to be exactly the same for VS Code as well.
Make sure to click the box on the «I accept the agreement » box and click on Next.

Accept the agreement and click Next
Keep everything as it is. Do not change anything from here.

Click Next
Click Next. Again, simply click Next.

Click Next
Make sure to add the checkmark (✔) on all of the boxes. Then click on Next.

Check all of the boxes, and click Next
Click on Install.

Click Install
It might take a little time to finish the installation.

Let it finish.
Click on Finish.

Click Finish
Congrats — you’ve successfully installed VS Code/VS Code Insiders on your system. Now, cheers!
How to Prepare VS Code/VS Code Insiders For C and C++ Code
First, open VS Code or VS Code Insiders.
Go to the Extension tab. Search for «C» or «C++» and install the first one that is already verified by Microsoft itself.

Install C/C++ extension
Also, install C/C++ Extension Pack. It should also be verified by Microsoft.

Install C/C++ Extension Pack
Then you have to search for Code Runner and install the extension as well.

Install Code Runner Extension
Now, we need to change some settings.

Change some settings
Click the gear box (It is called the Manage section), and then click Settings. Alternatively, you can also use the shortcut keys Ctrl + , . You need to replace the Ctrl key with the Command key for Mac.

Type «Run code in terminal» and press Enter key
In the search bar, type «Run code in terminal» and press the Enter key.
Scroll down a little bit until you find Code-runner: Run In Terminal . Make sure that the box is checked (✔).

Make sure to check the box
Now you need to restart your VS Code/VS Code Insiders. Simply close and reopen the program.
How to Test Your Code
Simply open VS Code/VS Code Insiders, open any folder, and create any file with the extension .c for the C file and .cpp for the C++ file.
After writing your code, you can run the code directly using the play button you’ll find in the upper right corner.

This is how you can run any C/C++ program from VS Code/Insiders
It will compile and then run the code directly. After running a code, the code runner button would be set default to run directly. So, your computer is 100% ready for compiling and running any C/C++ programming code.
Conclusion
Thanks for reading the entire article. If it helps you then you can also check out other articles of mine at freeCodeCamp.
If you want to get in touch with me, then you can do so using Twitter, LinkedIn, and GitHub.
You can also SUBSCRIBE to my YouTube channel (Code With FahimFBA) if you want to learn various kinds of programming languages with a lot of practical examples regularly.
If you want to check out my highlights, then you can do so at my Polywork timeline.
You can also visit my website to learn more about me and what I’m working on.
Среды разработки для С
Одной из распространенных сред разработки для программирования на Windows является Visual Studio . В данном случае мы будем использовать бесплатную и полнофункциональную среду Visual Studio 2019 Community, которую можно найти по адресу https://visualstudio.microsoft.com/ru/vs/community/.
После загрузки и запуска установщика Visual Studio в нем необходимо отметить пункт Разработка классических приложений на C++ :

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

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

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

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

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

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

В правой части окна для поля Compile As установим значение Compile as C Code (/TC) . Тем самым мы говорим, чтобы по умолчанию исходный код компилировался именно как код С, а не С++.
После установки этого значения нажмем на кнопку «Применить», чтобы новые настройки конфигурации вступили в силу.
Для работы с языком Си может быть полезна еще одна настройка — установка стандарта языка. Перейдем к пункту С/С++ -> Language . Здесь в поле C Language Standard мы можем установить один из доступных стандартов для языка Си, который будет применяться для компиляции:

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

Вкратце пробежимся по этой структуре. Окно 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 передаст исходный код компилятору, который скомпилирует из кода исполняемый файл exe, который потом будет запущен на выполнение. И мы увидим на запущенной консоли наше сообщение:

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