开发者

set visual studio 2008 compiler for c not c++

开发者 https://www.devze.com 2022-12-15 09:51 出处:网络
I have installed visual studio 2008 and i want to create some simple applications using C language. I do this by creating c++ console applications but i want the compiler to work for C not C++. Any wa

I have installed visual studio 2008 and i want to create some simple applications using C language. I do this by creating c++ console applications but i want the compiler to work for C not C++. Any wa开发者_JAVA百科y to accomplish this or i need another compiler if i want to deal with C?


Use .c file extension instead of .cpp, those files will be compiled as C-only code by default in a C/C++ Visual Studio project.


Just create files ending with .c instead of .cpp - MSVC will run the C compiler on them automatically. Note that it also allows you to intermix C and C++ freely (in different files, of course), as long as you stick to the rules (extern "C", etc.)


Try using /TP /TC compiler flags, you can find them in compiler group of project settings. Flags are documented here: MSDN.

0

精彩评论

暂无评论...
验证码 换一张
取 消