How to disable a specific nvcc compiler warnings

前端 未结 6 1605
无人及你
无人及你 2020-12-08 11:45

I want to disable a specific compiler warning with nvcc, specifically

warning: NULL reference is not allowed

The co

6条回答
  •  [愿得一人]
    2020-12-08 12:09

    I struggled to find a matching -Xcudafe for my warning. So here is another way.

    You can pass a compiler flag to CL.exe that will disable a specific warning. For example, to disable the warnings about unchecked iterators you can pass /wd4996.

    warning C4996: 'std::_Copy_impl': Function call with parameters that may be
    unsafe - this call relies on the caller to check that the passed values are 
    correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See 
    documentation on how to use Visual C++ 'Checked Iterators'
    

    The tricky thing here is that by default the arguments from the host compiler settings are not passed to nvcc, so you need to add it via the CUDA C/C++ dialog.

提交回复
热议问题