gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 04:42:25 24 4
gpt4 key购买 nike

我正在尝试使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com