-
defined but not usedsrc/compile 2009. 6. 5. 12:03
static 선언한 변수에서 컴파일워닝 발생
../include/snq_err.h|74| warning: 'csm_err_string' defined but not usedstatic 변수를 .h 파일에 선언한다.
이 변수는 헤더를 인클루드 하는 .c 파일내에서만 유효하다.
.h 를 인클루드한 모든 .c 파일들에 static 변수의 카피가 생성된다.
static 을 빼고 멀티 .c 파일이 .h 를 인클루드 하면 duplicate definition error.프로젝트에 변수가 한개만 있도록 만들려면,
.h 에 extern int 로 선언하고 .h 에서 assign 하지 않는다.
한 개 . 파일에서 extern 을 빼고 define 한다