What is the best way to do this? The templates seem to allow only for C++ (which is basically compatible with C, but not the same.) What is the proper way to do this? (A particular #define or whatever.) Any help would be appreciated.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The solution is simple and easy
You create a new win32 console project
Remove the default .cpp file
Add new .c file as you wish
In Properties, under C/C++ --> All Options, find "Compile as", then select "Compile as C code"
Simple sanity check. This code doesn't work with C++ since "new" is a reserved word for C++.
int new = 10;