Answered by:
c

Question
-
can i run c programs in visual c++ express. if so, how?Friday, January 6, 2012 2:35 AM
Answers
-
Yes. Make sure your file name ends with the ".c" extension, and Visual Studio will use the C compiler, rather than the C++ compiler.
- Proposed as answer by pvdg42 Tuesday, January 10, 2012 12:49 AM
- Marked as answer by Helen Zhao Thursday, January 12, 2012 8:47 AM
Friday, January 6, 2012 3:00 AM -
Hi charliebe,
Thanks for your post in the MSDN Forum.
As far as I know, Visual C++ 2010 and 2008 include C compilers that you can use to create everything from basic C programs to Windows API applications.
By default, Visual Studio 2010 will compile as C++ code. That is, "default" for "Compile As" option on project Property Pages->Configuration Properties->C/C++->Advance means "compile as C++ code (/TP)". But you can choose "Compile as C Code (/TC)" as well. It specifies to the compiler to treat all files named on the command line as C source files.
When you create source files for your C application, you can choose .c extension instead of .cpp. Then the compiler will compile the application as C code, too. Here is a document about compiling a C program in Visual studio, please refer to it for more information: http://msdn.microsoft.com/en-us/library/bb384838(v=VS.100).aspx.
I hope this reply if helpful to you. If you have any questions, please feel free to let me know.
Best regards,
Helen Zhao [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Helen Zhao Thursday, January 12, 2012 8:47 AM
Monday, January 9, 2012 3:02 AM
All replies
-
Yes. Make sure your file name ends with the ".c" extension, and Visual Studio will use the C compiler, rather than the C++ compiler.
- Proposed as answer by pvdg42 Tuesday, January 10, 2012 12:49 AM
- Marked as answer by Helen Zhao Thursday, January 12, 2012 8:47 AM
Friday, January 6, 2012 3:00 AM -
Hi charliebe,
Thanks for your post in the MSDN Forum.
As far as I know, Visual C++ 2010 and 2008 include C compilers that you can use to create everything from basic C programs to Windows API applications.
By default, Visual Studio 2010 will compile as C++ code. That is, "default" for "Compile As" option on project Property Pages->Configuration Properties->C/C++->Advance means "compile as C++ code (/TP)". But you can choose "Compile as C Code (/TC)" as well. It specifies to the compiler to treat all files named on the command line as C source files.
When you create source files for your C application, you can choose .c extension instead of .cpp. Then the compiler will compile the application as C code, too. Here is a document about compiling a C program in Visual studio, please refer to it for more information: http://msdn.microsoft.com/en-us/library/bb384838(v=VS.100).aspx.
I hope this reply if helpful to you. If you have any questions, please feel free to let me know.
Best regards,
Helen Zhao [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Helen Zhao Thursday, January 12, 2012 8:47 AM
Monday, January 9, 2012 3:02 AM