在项目开发时,遇到编译出错,看提示是重复的定义,错误信息如下:
In file included from ./include/wrn/wm/common/wm.h:176,
from ./include/wrn/wm/http/httpLib.h:55,from ./include/wrn/wm/common/wmAuth.h:17,
from src/common/wmAuth.c:49:
./include/wrn/wm/common/wmData.h:241: error: two or more data types in declaration specifiers
./include/wrn/wm/common/wmData.h:241: warning: useless type name in empty declaration
./include/wrn/wm/common/wmData.h:242: error: two or more data types in declaration specifiers
./include/wrn/wm/common/wmData.h:242: warning: useless type name in empty declaration
src/common/wmAuth.c: In function 'wm_string_getCode':
src/common/wmAuth.c:816: warning: comparison between pointer and integer
src/common/wmAuth.c: In function 'wmAuthSetNewCookie':
src/common/wmAuth.c:2323: warning: passing argument 2 of 'wmAUTHGetClientCookie' from incompatible pointer type
src/common/wmAuth.c:2324: warning: passing argument 3 of 'httpMimeOutCookieSet' from incompatible pointer type
make[1]: *** [src/common/wmAuth.o] Error 1
make: *** [webserver_build] Error 2
网上查看过,说是加分号,和其他头文件存在相同的定义,但是查找过,本地文件目录和交叉编译工具链中的头文件,都没有发现相同的定义:
./include/wm_options.h:typedef int sbyte4;
./include/wrn/wm/backplane/wmbLib.h:typedef int WMB_RID_T;
./include/wrn/wm/backplane/wmbLib.h:typedef int WMB_DOMAIN_T;
./include/wrn/wm/backplane/wmb.h:typedef int WMB_HASH_HINT_T;
./include/wrn/wm/backplane/wmb.h:typedef int WMB_ROLES_T;
./include/wrn/wm/backplane/wmb.h:typedef int WMB_RESOURCE_ID_T;
./include/wrn/wm/backplane/wmb.h:typedef int WMB_ARCHIVE_TYPE_T;
./include/wrn/wm/backplane/wmb.h:typedef int WMB_CMD_T;
./include/wrn/wm/common/wmnet.h:typedef int OS_SOCKET_T;
./include/wrn/wm/common/wmnet.h:typedef int OS_SOCKET_T;
./include/wrn/wm/common/wmnet.h:typedef int OS_SOCKET_T;
./include/wrn/wm/common/wmnet.h:typedef int OS_SOCKET_T;
./include/wrn/wm/common/wmnet.h:typedef int OS_SOCKET_T;
./include/wrn/wm/common/wm.h:typedef int sbyte4;
./include/wrn/wm/common/wmos.h:typedef int OS_THREAD_T;
./include/wrn/wm/common/wmos.h:typedef int OS_SEM_T;
./include/wrn/wm/common/wmos.h:typedef int OS_MSGQ_T;
./include/wrn/wm/common/wmos.h:typedef int OS_PIPE_T;
./include/wrn/wm/common/wmos.h:typedef int OS_TIME_T;
./include/wrn/wm/common/wmos.h:typedef int SHARED_DATA_T;
./include/wrn/wm/common/wmos.h:typedef int OS_SEM_T;
./include/wrn/wm/common/wmos.h:typedef int OS_MSGQ_T;
./include/wrn/wm/common/wmos.h:typedef int OS_PIPE_T;
./include/wrn/wm/common/wmos.h:typedef int SHARED_DATA_T;
./include/wrn/wm/common/wmos.h:typedef int OS_SEM_T;
./include/wrn/wm/common/wmos.h:typedef int OS_MSGQ_T;
./include/wrn/wm/common/wmos.h:typedef int OS_PIPE_T;
./include/wrn/wm/common/wmos.h:typedef int SHARED_DATA_T;
./include/wrn/wm/common/wmos.h:typedef int OS_MSGQ_T;
./include/wrn/wm/common/wmos.h:typedef int OS_PIPE_T;
./include/wrn/wm/common/wmos.h:typedef int SHARED_DATA_T;
./include/wrn/wm/common/wmos.h:typedef int OS_ARG_T;
./include/wrn/wm/common/wmos.h:typedef int OS_THREAD_T;
./include/wrn/wm/common/wmos.h:typedef int OS_PIPE_T;
./include/wrn/wm/common/wmos.h:typedef int OS_ARG_T;
./include/wrn/wm/common/wmos.h:typedef int SHARED_DATA_T;
./include/wrn/wm/common/wmos.h: typedef int OS_MSGQ_T;
./include/wrn/wm/common/wmos.h:typedef int SD_ID;
./include/wrn/wm/common/wmData.h:typedef int CompareType;
./include/wrn/wm/common/wmData.h:typedef int STATUS;
./include/wrn/wm/common/wmData.h:typedef int BOOL;
./include/wrn/wm/common/zlib/vxWorks/zconf.h:typedef int FAR intf;
查看提示错误的地方,是一个类型的定义:
typedef int STATUS;;
typedef int BOOL;;
修改成:
#ifndef STATUS
#define STATUS int
#endif
#ifndef BOOL
#define BOOL int
#endif