프로젝트의 여러 파일에 포함되어 일반 헤더를 포함하는 global.h
파일이 있습니다. 파일의 관련 내용은 아래와 같습니다 :경고 : 데이터 정의에 유형 또는 저장소 클래스가 없음
#define DEBUG
#ifdef DEBUG
extern int debug_level;
#endif
그것은 main.c
에 포함 된 다음 줄에 해당하는 경고가 컴파일러에 의해 발행 main.c
#ifdef DEBUG
debug_level = 6; //compiler generates warning corresponding to this line.
#endif
경고 메시지가입니다
src/main.c:14:1: warning: data definition has no type or storage class [enabled by default]
src/main.c:14:1: warning: type defaults to ‘int’ in declaration of ‘debug_level’ [enabled by default]
내가 잘못하고있는 것이 무엇인지 이해할 수 없습니다. 놀랍게도이 프로그램은 컴파일러가 숫자가 int
(기본적으로)이라고 가정하기 때문에 잘 작동합니다.
어디에서이 변수를 정의합니까 ?? –
'main.c'는 실제로'global.h'을 포함합니까? –
[Strange GCC 경고 : 스토리지 클래스 및 유형] (http://stackoverflow.com/questions/7703260/strange-gcc-warning-on-storage-class-and-type) – Mike