用纯C生成Visual Studio 2013项目 [英] Build a Visual Studio 2013 project in pure C
问题描述
做到这一点的最佳方法是什么?模板似乎只允许使用C ++(与C基本兼容,但不完全相同.)执行此操作的正确方法是什么? (特定的#define或其他内容.)任何帮助将不胜感激.
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.
推荐答案
该解决方案简单易行
-
您创建一个新的win32控制台项目
You create a new win32 console project
删除默认的.cpp文件
Remove the default .cpp file
根据需要添加新的.c文件
Add new .c file as you wish
在属性"下的C/C ++->所有选项"下,找到编译为",然后选择编译为C代码"
In Properties, under C/C++ --> All Options, find "Compile as", then select "Compile as C code"
-
简单的健全性检查.该代码不适用于C ++,因为新"是C ++的保留字.
Simple sanity check. This code doesn't work with C++ since "new" is a reserved word for C++.
int new = 10;
int new = 10;
这篇关于用纯C生成Visual Studio 2013项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!