如何在Visual Studio 2013中添加新的C文件(How do I add a new C file in Visual Studio 2013)
我是Visual Studio 2013的新手,过去曾使用过2010。 如何添加C文件? 似乎只有C ++的选项。 我不使用C ++,只使用C,我编译为ANSI C99。 当我选择“添加新项”时,这就是对话框的样子:
如您所见,它可以选择添加C ++文件或头文件,但不能添加C文件。
I am new to Visual Studio 2013, having used 2010 in the past. How do I add a C file? There only seems to be an option for C++. I do not use C++, only C, and I compile to ANSI C99. This is what the dialog box looks like when I pick "Add New Item":
As you can see it has choices to add a C++ file or a header file, but not a C file.
原文:https://stackoverflow.com/questions/29658290
更新时间:2019-12-28 22:12
最满意答案
将文件添加到解决方案后,右键单击它,然后在C / C ++ - > Advanced-> Compile As中,单击Compile as C Code(/ TC)
重命名文件是不够的,您需要告诉Visual Studio 2013是一个C文件。 Visual Studio 2013不支持C99标准,但至少它将使用C ABI,您将限制编译器仅接受C语句。
Visual Studio 2015完全实现了C99标准库,但依赖于Visual C ++编译器尚不支持的编译器功能的任何库功能除外(例如, 未实现)。
After adding the file to the solution, right-click on it, and in C/C++->Advanced->Compile As, click on Compile as C Code (/TC)
Renaming the file is not enough, you need to tell Visual Studio 2013 is a C file. Visual Studio 2013 does not support the C99 standard, but at least it will be using C ABI and you will restrict the compiler to accept C statements only.
Visual Studio 2015 fully implements the C99 Standard Library, with the exception of any library features that depend on compiler features not yet supported by the Visual C++ compiler (for example, is not implemented).
相关问答
在Update 2中启用了在Visual Studio 2013中添加和编辑标签。 我目前正在运行Visual Studio 2013 Update 4,并且该功能在那里可用。 确保您下载并安装最新版本的Visual Studio 2013以访问最新商品 。 Adding and editing tags in Visual Studio 2013 has been enabled in Update 2. I'm currently running Visual Studio 2013 Upda
...
Visual Studio 2013不再具有针对不同ASP.Net功能的独立项目类型。 您必须选择.NET Framework 4.5(或更高版本)才能查看ASP.NET Web应用程序模板(适用于ASP.NET One)。 所以只需选择Visual C#> Web> ASP.NET Web应用程序,然后在下一步中选择MVC复选框。 注意:确保不要选择C#> Web> Visual Studio 2012子文件夹。 Visual Studio 2013 no longer has separate
...
这样做了。 我真的希望这能阻止某人跳下桥。 NoGit是一个很好的扩展,但最终它归结为删除Git源代码控制提供程序的注册表项。 http://blog.markrendle.net/disable-the-git-source-control-add-in-in-vs2013-permanently/ This did it. I really hope this keeps someone from jumping off the bridge. NoGit is a great extensi
...
我今天决定重新审视这个问题并找出问题所在! 在我的环境变量设置中,引用了版本11(VS 2012)的路径。 我完全删除了这个引用: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64
C:\Program Files (
...
Visual Studio世界使用“.h”扩展名,这就是它的样子,它不会影响你使用的扩展名。 无论如何,它们都是“.cpp”文件的一部分,当它们被“包含”时,它们在编译器运行时直接复制到“#include”行的位置。 他们可以有任何扩展。 源文件是否为“.c”或“.cpp”,编译模式是否在项目属性中设置也是无关紧要的,除非您故意改变它,否则将使大部分SDK无法使用。 The Visual Studio world uses ".h" extension, that's just the way i
...
好吧,所以对我的MATLAB“R2011b”版本唯一有效的是Microsoft SDK 7.1,因为其他编译器对于Windows 7 64位来说太旧了。 MinGW-64位不受支持。 虽然它适用于MATLAB,但Stateflow不承认它。 所以我刚刚从这里下载了.iso文件。 如果您在安装SDK时遇到任何困难,请尝试此操作 。 Okay, so the only thing that works for my version of MATLAB "R2011b" is Microsoft SDK
...
为了形式化和扩展我的注释, Console类和System命名空间通常是.NET框架的一部分。 在该上下文中, Console :: SetCursorPosition(int,int)方法的MSDN文档页面中包含的“C ++”选项卡实际上是指C ++ / CLI语言 。 C ++ / CLI语言与C ++语言截然不同(尽管有意相似)。 相应地,C ++ / CLI语言包含编译Win32项目时使用的C ++编译器工具集无法识别的各种构造。 换句话说,要摆脱"Error: name must be
...
简单的拖放应该工作。 将源目录保存在项目目录中。 将目录结构从Windows资源管理器拖放到Visual Studio现有项目。 单击“解决方案资源管理器”工具箱顶部的“ Show All Files ”选项 执行此操作后,您需要在项目中添加此目录。 选择该目录,右键单击并选择“ Include in project ” 你已准备好出发! 细节在这里 Simple Drag and Drop should work. Keep your directory with source inside y
...
ANTLR 4 NuGet包和ANTLR语言支持扩展是两个完全独立的产品(两者都不依赖于其他产品,尽管它们最常用在一起)。 ANTLR 4 NuGet包不依赖于任何特定版本的Visual Studio,因此它可以与Visual Studio 2013一起使用。截至今天,已经通过Visual Studio 2013为Visual Studio 2010发布了ANTLR语言支持扩展。 The ANTLR 4 NuGet package and the ANTLR Language Support ex
...
将文件添加到解决方案后,右键单击它,然后在C / C ++ - > Advanced-> Compile As中,单击Compile as C Code(/ TC) 重命名文件是不够的,您需要告诉Visual Studio 2013是一个C文件。 Visual Studio 2013不支持C99标准,但至少它将使用C ABI,您将限制编译器仅接受C语句。 Visual Studio 2015完全实现了C99标准库,但依赖于Visual C ++编译器尚不支持的编译器功能的任何库功能除外(例如, <
...