c++ - VS 2017 命令行错误 D8004

标签 c++ visual-studio-2017 suppress-warnings

我别无选择,我正在尝试在 Visual Studio 2017 社区上使用 GoogleTest,但它给了我很多

warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED. You can define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING to acknowledge that you have received this warning.

我想抑制它,所以我进入我的项目属性 -> C/C++ -> 高级 -> 抑制特定警告,然后尝试

/wd4996
/wdSTL4002,
/wd4996;
/wdC4996
/wd[4996]...

等等,老实说,我尝试了每一种可能的组合,但它让我失望了

2>cl : Command line error D8004: '/wd' requires an argument

有人可以准确地向我发送我需要在那里写的内容来抑制这种情况吗?

最佳答案

根据报错信息,可以在命令行添加一个#define等价物:

/D:_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING

相当于在源文件的第一行之前插入

#define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING  1

关于c++ - VS 2017 命令行错误 D8004,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48091421/

相关文章:

成员函数中的 C++ 静态变量

c++ - 扩展 Visual Studio C++ 构建过程

c# - Visual Studio 2017 SmartDeviceException DEP6200 错误

python - 如何在Python的IDE中禁止显示警告? (IDE为Jupyter)

clang++ - 如何禁用 Clang 警告 "no case matching constant switch condition"

c++ - 信号的总能量

azure - VS 2017 Pro 中没有针对 ASP.NET Core 应用程序的发布选项

c++ - 在 VS 上使用 Qt 库

selenium - 如何使用 Selenium::Remote::Driver 抑制 "warning"?

c++ - 使用 Rcpp 构建包时处理修饰的外部二进制文件