用纯 C 语言构建 Visual Studio 2013 项目 [英] Build a Visual Studio 2013 project in pure C

查看:27
本文介绍了用纯 C 语言构建 Visual Studio 2013 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样做的最佳方法是什么?模板似乎只允许 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.

推荐答案

解决方案简单易行

  1. 您创建了一个新的 win32 控制台项目

  1. 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"

  1. 简单的健全性检查.此代码不适用于 C++,因为new"是 C++ 的保留字.

  1. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆