c - 如何在 Visual Studio 中创建 C(而非 C++)控制台应用程序

标签 c visual-studio visual-studio-2012

我正在尝试使用 VS2012 执行以下操作:

文件->新建项目->Win 32 控制台应用程序。 转到属性 C/C++-> 高级并设置 Compile as C Code (/TC)

重命名源文件扩展名 cpp->c(不确定是否需要)

但无论如何项目都是像 C++ 一样编译的。

要使项目编译为 C,还应该做些什么?

最佳答案

来自MSDN ,

By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.

此外,Compiling with ANSI C in Visual Studio

关于c - 如何在 Visual Studio 中创建 C(而非 C++)控制台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24985471/

相关文章:

c - 重新分配 x86 x86_64

c - 共享内存的问题

visual-studio - Visual Studio 2008 Express 是否支持 t4?

c++ - 无法使用 Visual Studio 2019.7.2 编译虚幻引擎 4.25

c++ - 调用 D3DX10CreateEffectFromFile() 方法的链接器问题

visual-studio-2010 - Visual Studio 解决方案资源管理器位置

C:动态分配时通过引用传递

visual-studio-2012 - 如何阻止 Visual Studio 2012 在执行后关闭控制台窗口?

unit-testing - 按项目分组时,测试显示在测试资源管理器中的 "External"类别下

c - 在 64 位 gentoo linux 上运行 32 位程序