天天看點

解決visio studio中使用string字元串的copy()函數的報錯D_SCL_SECURE_NO_WARNINGS

rror C4996: ‘std::basic_string<char,std::char_traits,std::allocator>::copy’: 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’

解決辦法:

右鍵項目-->屬性--> 【通用配置】/【c/c++】/ 【預處理器】中第一行 【預處理器定義】中右邊點選編譯 ,在最下方加入_SCL_SECURE_NO_WARNINGS 确定即可;
           

注意: 添加的是_SCL_SECURE_NO_WARNINGS 去掉提示錯誤-D_SCL_SECURE_NO_WARNINGS前面的-D ;