Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set Visual Studio 2010 Professional up as an IDE for C?

Not C++, not C#, just plain old C for my computer science class.

I see options for C#, F#, Visual Basic, and Visual C++, but if there's an easy way to get it to work with C, I'm not seeing it.

*"set up as an IDE" in this case, meaning use Visual Studio to compile, debug, and run the written programs via VS2010, just as I've been using it previously for programming in c#.

like image 231
Raven Dreamer Avatar asked Dec 29 '22 08:12

Raven Dreamer


2 Answers

Nothing special is needed. Just write your code in a .c source code file instead of a .cpp file. The project templates create .cpp files, just rename them with right-click + Rename.

like image 117
Hans Passant Avatar answered Feb 01 '23 10:02

Hans Passant


Create an empty C++ project.

Bring up the project's properties by right clicking on it in the solution explorer and selecting "Properties".

Browse to Configuration Properties -> C/C++ -> Advanced.

Switch the Compile As property to "Compile as C Code (/TC)". This will compile all source files as C.

See also the /TC compiler option: http://msdn.microsoft.com/en-us/library/032xwy55%28v=VS.71%29.aspx.

like image 43
Corbin March Avatar answered Feb 01 '23 08:02

Corbin March