D_SCL-SECURE_NO_WARNING ERROR 해결법
D_SCL-SECURE_NO_WARNING ERROR 해결법
처음 격어보게 되어 남기게 되었습니다.
코드를 다른 컴퓨터에서 작업할시에
심각도 코드 설명 프로젝트 파일 줄 비표시 오류(Suppression) 상태
오류
C4996'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' 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' test c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.14.26428\include\xutility 2483
발생하는 에러가 발생하였을때 해결법
보통 일반적인 전역 헤더파일이 존재할것이다.
예제) 전역헤더
#pragma once
#include
#include
#include
#include
#include
using namespace std;
처음 격어본 에러로써 해결방법으론
#define _SCL_SECURE_NO_WARNINGS
전역 헤더에서 가장위에 선언을 해주는것이다.
예제) 전역헤더 (추가 #define _SCL_SECURE_NO_WARNINGS)
#pragma once
#define _SCL_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include
using namespace std;
이렇게 하면 기존의 소스 코드를 전혀 변경하지 않고 컴파일할 수 있습니다. 단지, 보안 취약점은 여전히 안고 간다는 문제가 있다고 합니다.
참조 사이트 입니다: https://stackoverflow.com/questions/25046829/what-does-use-d-scl-secure-no-warnings-mean
https://www.sysnet.pe.kr/2/0/11317