VS 2017 Command line error D8004

浪子不回头ぞ 提交于 2020-03-23 05:41:49

问题


I'm out of options, I'm trying to work with GoogleTest on Visual Studio 2017 Community but it gives me a lot of

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.

I want to supress it, so I go under my Project Properties -> C/C++ -> Advanced -> Supress Specific Warnings and I try

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

etc, I honestly tried every possible combination and it throws me

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

Could someone send me exactly what I need to write there to supress this?


回答1:


According to the error message, you can add a #define equivalent to the command line:

/D:_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING

That is the equivalent of inserting before the first line of the source files

#define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING  1



回答2:


Please follow the following steps:

  1. Click View in the tool baar.

  2. Select properties.. at the bottom.

3.Select c/c++ -> Preprocessor.

4.Set Preprocessor Definitions as _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING




回答3:


I know this has an answer already, but to answer your question specifically, if you simply add 4996, as opposed to /wd[4996] (or any other variation of that).

All you need to add is 4996.




回答4:


Silencing warnings is never a good option. In this case warning about tr1 seems to arise from incorrect project configuration. You can try defining GTEST_LANG_CXX11 to make gtest use stuff from std namespace or track origins of those warnings and figure out why are they still issued.



来源:https://stackoverflow.com/questions/48091421/vs-2017-command-line-error-d8004

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!