gcc의 에러 메세지에 관한 도움말이 있습니까? Man page 말고요
글쓴이: indizarm / 작성시간: 월, 2003/09/08 - 10:19오전
음... 뭐 모든 컴파일러가 제 취향에 맞는 에러 메세지를
생성하는 것은 아니지만, 에러 메세지들이 너무 낯설어서
'에러 메세지에 관한 도움말'이 있었으면 하는 생각이 들
었습니다.
다음은 간단한 소스와 그에 대한 에러 메세지 입니다.
<tmp_hdr.h> #if !defined TMP_HDR_H #define TMP_HDR_H struct test; typedef struct test* ptr; typedef struct test { int i; char ch; ptr next; }; #endif <test.c> #include<stdio.h> #include"tmp_hdr.h" int main() { test jkl; jkl.i = 1; jkl.ch = 'A'; return 0; } <에러 메세지> [indizarm@je2 testbed]$ gcc -o test test.c test.c:6: two or more data types in declaration of `main' test.c:6: function definition declared `typedef' test.c: In function `main': test.c:7: `test' undeclared (first use in this function) test.c:7: (Each undeclared identifier is reported only once test.c:7: for each function it appears in.) test.c:7: parse error before "jkl" test.c:9: `jkl' undeclared (first use in this function)
Forums:
typedef struct test{ int i;
typedef struct test
{
int i;
char ch;
ptr next;
};
위에서 typedef 를 빼세요.
test jkl;
에서 struct test jkl; 로 사용하세요.
아니면 typedef struct test { ..blabla } test; 로 하시던지.
screen + vim + ctags 좋아요~
김충길님 감사합니다.
김충길님 답변 감사합니다.
그런데 nested struct의 경우에 사용할 수 있는
범위가 선언된 블록의 안이 아닙니까?
이렇게 하면 struct in redefinition 이라고 에러가
뜨더군요. 제 생각으로는 nested struct의 경우엔
선언된 블록 내에서만 효력이 있을 것으로 생각했습
니다만...
What a Cool Days!!!
GCC Manual...인데 도움이 될지 모르겠습니다.http
GCC Manual...인데 도움이 될지 모르겠습니다.
http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Trouble.html#Trouble
_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz
purewell님 답변 감사합니다.
purewell님 답변 감사합니다.
^_^
What a Cool Days!!!
댓글 달기