問題描述
有沒有辦法在默認(rèn)情況下為所有項目設(shè)置刪除使用 scanf() 等函數(shù)時出現(xiàn)的預(yù)編譯器安全警告.我發(fā)現(xiàn)您可以通過在項目選項中添加一行或在代碼開頭添加 #define _CRT_SECURE_NO_WARNINGS
來實現(xiàn).
Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf(). I found that you can do it by adding a line in the project option or a #define _CRT_SECURE_NO_WARNINGS
in the beginning of the code.
我發(fā)現(xiàn)自己不斷地為解決編程競賽而創(chuàng)建新項目,添加內(nèi)容真的很煩人(并且需要花費寶貴的時間):
I find myself repeatedly creating new projects for solving programming contests and it is really annoying (and takes valuable time) to add:
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
在代碼的開頭,或者每次啟動新項目時在預(yù)編譯器選項中設(shè)置.
In the beginning of the code, or to set it in the precompiler options every time I start a new project.
推薦答案
在解決方案資源管理器中標(biāo)記所有需要的項目.
Mark all the desired projects in solution explorer.
按 Alt-F7 或右鍵單擊解決方案資源管理器并選擇屬性"
Press Alt-F7 or right click in solution explorer and select "Properties"
配置:所有配置
點擊預(yù)處理器定義行以調(diào)用其編輯器
Click on the Preprocessor Definitions line to invoke its editor
選擇編輯...
將_CRT_SECURE_NO_WARNINGS"復(fù)制到頂部的預(yù)處理器定義白框中.
Copy "_CRT_SECURE_NO_WARNINGS" into the Preprocessor Definitions white box on the top.
這篇關(guān)于默認(rèn)情況下,在 Visual Studio 中從項目中刪除安全警告 (_CRT_SECURE_NO_WARNINGS)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!