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 ?

asked Jun 16, 2019 at 9:09 Tarek EZZAT Tarek EZZAT 343 1 1 gold badge 5 5 silver badges 17 17 bronze badges

it depends on the file suffix - so change the file suffix of your source to .c and then it is compiled as C

Commented Jun 16, 2019 at 9:30 Just add .c files to your project. Commented Jun 16, 2019 at 9:39 You can see this video. Commented Jun 16, 2019 at 10:14

4 Answers 4

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.

answered May 4, 2020 at 11:26 Daemon Painter Daemon Painter 3,389 3 3 gold badges 32 32 silver badges 48 48 bronze badges

In addition, you will want to go into the project settings to set the C language standard to C17 instead of Legacy MSVC, as Legacy MSVC uses ancient C89 with a bit of C99, I think. If you want to use I/O functions which MS thinks are "insecure" such as sprintf , strcpy etc. you will want to go into preprocessor definitions and add _CRT_SECURE_NO_WARNINGS .