Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing C code in Visual C++ on VS2010

I appreciate the differences are negligible, but im doing some number crunching and so i want to use C. Ive just created a project in VS2010, chosen a C++ project and written some C. All executes fine, but

is this being created and executed in the fast(er) C compiler or the C++ because its a C++ project?

How can i specify that the code i wish to write is actually C and to be compiled and run as C?

like image 295
Tom Avatar asked Oct 30 '10 23:10

Tom


1 Answers

The Visual Studio C++ compiler will treat all .c files as C language files and compile them as such.

Additional reference:

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.

http://msdn.microsoft.com/en-us/library/bb384838.aspx

like image 74
Inisheer Avatar answered Sep 26 '22 01:09

Inisheer