컴파일 에러좀 잡아주세요..^^
#include <stdlib.h> #include <netinet/ip6.h> #include <inet/ip.h> #include <inet/tcp.h> #include <sys/stream.h> #include <sys/strsubr.h> main() { struct module_info l_stMoInfo; struct queue l_stQueue; struct qinit l_stQinit; struct stdata l_stStdata; struct ipcs_s l_stIpcs; struct tcp_s l_stTcps; }
g++ -D_KMEMUSER -c test.cpp
Compile Error :
In file included from test.cpp:4:
/usr/include/inet/tcp.h:398: syntax error before `;'
In file included from test.cpp:6:
/usr/include/sys/strsubr.h:684: field `qu_rqueue' has incomplete type
/usr/include/sys/strsubr.h:685: field `qu_wqueue' has incomplete type
test.cpp: In function `int main()':
test.cpp:11: aggregate `struct queue l_stQueue' has incomplete type and cannot be initialized
test.cpp:14: aggregate `struct ipcs_s l_stIpcs' has incomplete type and cannot be initialized
서버 (SunOS zeus 5.8 Generic_108529-09 i86pc i386 i86pc)
gcc (gcc version 2.95.3 20010315 (release))
-----------------------------------------------------------------------------------
이 소스를 test.c 로 변경해서 컴팡리 할 경우는
gcc -c test.c
In file included from test.c:6:
/usr/include/sys/strsubr.h:174: field `sd_pollist' has incomplete type
test.c: In function `main':
test.c:14: storage size of `l_stIpcs' isn't known
test.c:15: storage size of `l_stTcps' isn't known
이런 에러가 납니다.
해결책 좀 알려주시면 감사하겠습니다...
1. 해당 header file을 엽니다.2. struct type
1. 해당 header file을 엽니다.
2. struct type 명을 찾습니다.
3. grep -n {타입명} /usr/include/sys/*.h
로 선언된 곳을 찾습니다.
4. 선언된 header 를 포함시킵니다.
5. 만약 header내에 표준을 따르기 위한 매크로선언을 요구하는 곳이 있다면
적당한 define을 해준뒤에 include 하도록합니다.
---
http://coolengineer.com
[code:1]struct { ...};
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://cinsk.github.io/cfaqs/
댓글 달기