c - VS2013 假设 .c 文件的未识别符号的外部声明

标签 c compiler-construction visual-studio-2013

显然在 .c 文件中,visual studio 自动生成未识别符号的声明。我尝试在不包含 stdio.h 的情况下使用 printf(),以及调用一些随机的 asd() 函数,它编译时没有错误,只出现编译器假定 extern 返回 int 的警告。可以肯定的是,我编译了程序集输出,它确实有那些外部声明。当然链接不成功。

我的问题是,如何关闭这种自动生成未识别符号声明的功能?我有一些项目要做,它可能会把我搞砸。

最佳答案

这是编译器警告 C4013。

http://msdn.microsoft.com/en-us/library/d3ct4kz9.aspx

您可以使用/we 标志设置编译命令,将特定警告视为错误。

http://msdn.microsoft.com/en-us/library/thxezb7y.aspx

/we n Treats as an error the compiler warning that is specified in n. For example, /we4326 flags warning number C4326 as an error.

如果你想变得非常保守,你可以将所有警告都视为错误。许多团队/项目认为这是最佳实践。

/WX Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects. The linker also has a /WX option. See /WX (Treat Linker Warnings as Errors) for more information.

关于c - VS2013 假设 .c 文件的未识别符号的外部声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25127131/

相关文章:

linux - 为不同的机器在网络文件系统下构建程序并安装软件

c# - 在 Datagridview 中显示数据库搜索结果

opencv - 为两个Visual Studio版本安装两个OpenCv版本?

c++ - 在哪里可以找到当前的 C 或 C++ 标准文档?

delphi - RemObjects PascalScript 与 DWS 脚本相比有何优缺点?

build - 在 Windows 上是否有相当于 Make 的功能?

c# - 如何远程调试数据库的 ASP.NET MVC bug?

c - 写入的字节数始终为-1

c++ - abi-compliance-checker 中的扩展选项有什么用?

c - Xcode 给出了简单 C 数组的错误总和