vico
vico

Reputation: 18251

How to create C (not C++) console application in Visual Studio

I was trying with VS2012 to do following:

File->New Project->Win 32 Console application. Go to properties C/C++->advanced and set Compile as C Code (/TC)

Rename source files extension cpp->c (not sure it is needed)

But project is compiled like C++ anyway.

What else should be done to make project compile as C?

Upvotes: 4

Views: 11624

Answers (2)

Abhineet
Abhineet

Reputation: 5409

From the MSDN,

By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.

Also, Compiling with ANSI C in Visual Studio

Upvotes: 2

Ben Voigt
Ben Voigt

Reputation: 283981

It is compiling as C.

Not as C99 or C11 or C-plus-support-for-APIs-from-other-OSes.

Just plain ISO-standard-compliant C89/C90. Which is what the C compiler shipped with VS2012 supports.

Upvotes: 0

Related Questions