How to set up Visual Studio Community 2017 for C programming

To keep it simple, I’ll just focus on getting up and running to build console-based C applications. A few of the steps have changed since previous versions of Visual Studio (2015, 2013, etc.), so you if you’re familiar with those versions, you might want to have a look at these steps for Visual Studio 2017.

Check System Requirements and Licensing

First, check to make sure your system meets the minimum requirements of Visual Studio Community 2017. You can find the Visual Studio 2017 system requirements here. Also, make sure you read and understand the licensing terms. This free version of Visual Studio can be used for commercial development, if certain criteria are met. You can find the Visual Studio Community 2017 license agreement here.

Download and Install Visual Studio

Next, download Visual Studio Community 2017. You can find the Visual Studio Community 2017 download link here.

Then, install Visual Studio Community 2017. When it asks for which workloads you want to include, be sure to select, under Windows, Desktop development with C++. I know we want to program in C, but bear with me. This is how to get what you need for C programming.

 

Sign In or Sign Up

To keep your free license going, you need to connect the installation with an existing or new Microsoft account. There is no cost to sign up for one. The installer, after installation has succeeded, will ask you to sign in (or sign up for a new account). Take care of this now, at the end of the installation process. If you don’t do this, your Visual Studio Community license will time out after a few weeks.

 

Create a C Console Project

After everything is completely installed, and you’ve started up Visual Studio Community 2017 on your computer, here’s how you get started building console-based C programs:

  1. On the File menu, click New | Project.
  2. In the New Project window, on the left under Visual C++, click Windows Desktop. Near the bottom of the window, in the Name box, type the name of your project. In the upper middle section of the window, click Windows Desktop Wizard. Then click OK.
  3. In the Windows Desktop Project window, under Application type, click to select Console Application (.exe). Under Additional Options, click Empty Project. Then click OK.
  4. In the Solution Explorer section, right-click Source Files under your project name, and click Add | New Item.
  5. In the Add New Item window, on the left under Visual C++, click Code. In the middle section of the window, click C++ File (.cpp). Near the bottom of the Add New Item window, in the Name box, type the name of your source file, and be sure to end it with a .C extension (not the .CPP extension that’s already there). If you name your file with a .C extension, it will be built with the C compiler. If you name your file with a .CPP extension, it will be built with the C++ compiler. Click Add.
  6. The new empty .C source file will be opened in the code editor, and you can type your C source code there.  If you need to add more source files to your project, repeat steps 4 and 5 for each new source file you want to add.

If You Build It…

When you’re ready to build your project, click Build | Build projectname, where projectname is the name of your project. When you’re ready to run your program, you can click Debug | Start Without Debugging.

Again, any source files that end with a .C extension will be compiled with the C compiler, and any source files that end with a .CPP extension will be compiled with the C++ compiler.

These instructions should get you started on the path to writing console-based C applications using Visual Studio Community 2017.

Leave a Reply