Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE

前端 未结 10 1580
说谎
说谎 2020-12-02 06:00

What is the best way to disable the warnings generated via _CRT_SECURE_NO_DEPRECATE that allows them to be reinstated with ease and will work across Visual Stud

10条回答
  •  攒了一身酷
    2020-12-02 06:31

    i work on a multi platform project, so i can't use _s function and i don't want pollute my code with visual studio specific code.
    my solution is disable the warning 4996 on the visual studio project. go to Project -> Properties -> Configuration properties -> C/C++ -> Advanced -> Disable specific warning add the value 4996.
    if you use also the mfc and/or atl library (not my case) define before include mfc _AFX_SECURE_NO_DEPRECATE and before include atl _ATL_SECURE_NO_DEPRECATE.
    i use this solution across visual studio 2003 and 2005.

    p.s. if you use only visual studio the secure template overloads could be a good solution.

提交回复
热议问题