views:

952

answers:

4

Hi people!

Do you know if it's possible to programm c (not c++) in Visual Studio 2008? If yes then how? I haven't found any component for that.

Regards.

+1  A: 

You can specify any compiler you'd like in VisualStudio; therefore, if there's a specific C compiler you'd like to use, it will handle it.

William Leara
A: 

Doesn't the VC++ compiler also compile C code?

fretje
+5  A: 

As long as your source file has the .c extension, Microsoft C++ compiler will compile in C-mode.

In addition, the /Tc<source filename> switch can be used to force compilation of a specific file in C mode, and the /TC switch can be used to force C mode for all files. For C++, it's /Tp and /TP respectively.

ASk
Do I get an exeption if my programm has some c++ code in this way?
You should do. It's a while since I programmed in C though
ChrisF
yes, any C++ constructs present in files that are being compiled in C mode will fail to compile
ASk
+9  A: 

Just save the file with .c extension instead of .cpp and it will compile as C instead of C++. To be extra cautious, you can go to the project settings, under "Project -> Properties -> Configuration Properties -> C/C++ -> Advanced", make sure that "Compile As" says "Compile as C code (/TC)".

shoosh