If you’re in love with Visual Studio as I am, you would probably prefer to do all of your coding day in and day out in Visual Studio. However, sometimes some languages may not appear as if they are supported in Visual Studio. One of those languages is C. Visual Studio is well known for its support of C++ projects, but doesn’t explicitly list C as a language. Because C++ contains all of the features/functionality of C, the VS C++ compiler will also compile any C code you write. To create a C project in Visual Studio you just need to create an empty C++ project and add any appropriate .c / .h files as needed. All will compile and work just fine.

Here’s how you can start a new C project within Visual Studio.

Note: This tutorial is designed/tested around Visual Studio 2012, the latest version of Visual Studio available as of this writing. However, this should work for any version of Visual Studio.

  1. Open Visual Studio
  2. Select File –> New –> Project… (or CTRL+SHIFT+N for you keyboard fanatics)
  3. When the New Project dialog box appears select Visual C++ in the left pane. (You may need to go to Templates –> Other Languages –> Visual C++
  4. In the Project window, select Win32 Console Application
  5. Give an appropriate name to the project.
  6. The Win32 Application Wizard dialog box should appear
  7. Click Next at the Welcome to the Win32 Application Wizard page
  8. On the Application Settings page, make sure the following are selected:
    1. Application Type: Console application
    2. Additional Options: Empty Project
  9. Click Finish
  10. You now have a new “C” project

The following steps walk you through creating the actual C files.

  1. If Solution Explorer is not visible go to View –> Solution Explorer
  2. Right click the Source Files folder in Solution Explorer and select Add –> New Item…
  3. The Add New Item dialog box should appear.
  4. Select C++ File (.cpp) and name it an appropriate name, such as main.c (make sure to give it a .c extension)
  5. Start coding!

That should be all you need to know to create a new C project in Visual Studio. If you have any questions, feel free to leave a comment below.

Happy coding!