Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a C project in visual Studio 2019?

I installed Visual Studio 2019 and I want to create a C project. Not C++ and not C# There is no option for a C solution But the doc says VS is both a C and a C++ compiler. I see no option for a C solution. There is a doc on the net explaining how to create C project in console from command line. But I want to create a "normal" project.

What should I do ?

like image 723
Tarek EZZAT Avatar asked Jun 16 '19 09:06

Tarek EZZAT


2 Answers

I'll summarize what was explained in the video someone linked under your question, as I was able to reproduce the steps and create a working C project in Visual Studio. Kudos to the video creator and kiner_shah for sharing.

As a precondition, you shall be able to create C++ project in VS, so make sure you have the right extensions installed.

Create a new project (Shift+Ctrl+N), select Visual C++ and Console App. This will create a new console app with a default c++ main file. Remove that file and put in a main.c file. This can be compiled, and works just fine.

like image 189
Daemon Painter Avatar answered Oct 30 '22 05:10

Daemon Painter


You should be able to set up the environment by simply adding a ".c" extension to your code. Additionally, you can manually change your environment by opening your file in VS, clicking on the language displayed at the bottom (which should display "Select Language Mode" and choose C.

like image 37
ChocolateOverflow Avatar answered Oct 30 '22 04:10

ChocolateOverflow