当前位置: 技术问答>linux和unix
刚刚完成一个协议栈的架构,编译出现奇怪的错,调试了一整天仍然没有思路
来源: 互联网 发布时间:2015-12-23
本文导语: 刚刚完成一个协议栈的架构,编译出现奇怪的错。 错误提示如下: make server make[1]: Entering directory `/home/vserver/viewserver/tsp' g++ -Wall -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -O3 -fno-implicit-templates -DACE...
刚刚完成一个协议栈的架构,编译出现奇怪的错。
错误提示如下:
make server
make[1]: Entering directory `/home/vserver/viewserver/tsp'
g++ -Wall -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -O3 -fno-implicit-templates -DACE_HAS_EXCEPTIONS
-D_OS_LINUX -I/orbsvcs -I/home/vserver/ACE_wrappers/ace -I/home/vserver/ACE_wrappers -I/home/vserver/viewserver/include
tsplib.cpp -g -c -o /home/vserver/obj/viewserver/tsplib.o
tsplib.cpp:136: type specifier omitted for parameter
tsplib.cpp:136: parse error before numeric constant
tsplib.cpp: In function `int TSP_SendCommonTestOutSide(...)':
tsplib.cpp:150: `prCtxt' undeclared (first use this function)
tsplib.cpp:150: (Each undeclared identifier is reported only once for each
function it appears in.)
tsplib.cpp:156: `prCommonTESTOUTSIDE' undeclared (first use this function)
tsplib.cpp: At global scope:
tsplib.cpp:160: type specifier omitted for parameter
tsplib.cpp:160: parse error before numeric constant
tsplib.cpp: In function `int TSP_SendCommonResponse(...)':
tsplib.cpp:176: `ptCtxt' undeclared (first use this function)
tsplib.cpp:181: `prCommonResponse' undeclared (first use this function)
tsplib.cpp: In function `void TSP_OnRecvData(int, char*, int, char*, short
unsigned int)':
tsplib.cpp:243: `struct _TSP_CTXT' has no member named `sAreaCode'
tsplib.cpp:259: parse error before `*' token
tsplib.cpp:262: parse error before `*' token
tsplib.cpp: In function `int TSP_Init(int, char*)':
tsplib.cpp:294: parse error before `;' token
tsplib.cpp:295: parse error before `;' token
tsplib.cpp:301: parse error before `;' token
tsplib.cpp:302: parse error before `;' token
make[1]: *** [/home/vserver/obj/viewserver/tsplib.o] Error 1
make[1]: Leaving directory `/home/vserver/viewserver/tsp'
make: *** [ALL] Error 2
相关代码如下:
int TSP_SendMsg(int nHandle,char *pszMsgBuf,ushort nLen)
{
if ( g_rTSP.nMode == TSP_MODE_SERVER )
{
//printf("the pack len first is %dn",nLen);
return g_rTSP.rServer.SendMsg(nHandle,pszMsgBuf,nLen);
}
else
return g_rTSP.rClient.SendMsg(nHandle,pszMsgBuf,nLen);
}
int TSP_SendCommonTestOutSide(TSP_CTXT *prCtxt,TSP_Common_TESTOUTSIDE *prCommonTESTOUTSIDE);
{
char sTime[8];
char sTemp[40];
time_t temp;
time(&temp);
strcpy(sTemp,ctime(&temp));
strncpy(sTime,&sTemp[11],8);
sTime[8]='';
strcpy(g_rTSP.rSndPacket.rHeader.sLineType,"00");
sprintf(g_rTSP.rSndPacket.rHeader.sOrder,"%16s","TESTOUTSIDE");
strcpy(g_rTSP.rSndPacket.rHeader.sTaskID,prCtxt.sTaskID);
g_rTSP.rSndPacket.rHeader.nOrderSeq=prCtxt.OrderSeq;
strcpy(g_rTSP.rSndPacket.rHeader.sAreaCode,prCtxt.sAreaCode);
strcpy(g_rTSP.rSndPacket.rHeader.sSentTime,sTime);
sprintf(g_rTSP.rSndPacket.rHeader.nMsgBodyLen,"%08d",sizeof(TSP_Common_TESTOUTSIDE));
g_rTSP.rSndPacket.sTail=';';
memcpy(&g_rTSP.rSndPacket.sBody,(char *)prCommonTESTOUTSIDE,sizeof(TSP_Common_TESTOUTSIDE) );
return TSP_SendMsg(prCtxt->nHandle,(char*)&g_rTSP.rSndPacket,PACKET_HEAD_SIZE+sizeof(TSP_Common_TESTOUTSIDE)+1);
}
错误提示如下:
make server
make[1]: Entering directory `/home/vserver/viewserver/tsp'
g++ -Wall -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -O3 -fno-implicit-templates -DACE_HAS_EXCEPTIONS
-D_OS_LINUX -I/orbsvcs -I/home/vserver/ACE_wrappers/ace -I/home/vserver/ACE_wrappers -I/home/vserver/viewserver/include
tsplib.cpp -g -c -o /home/vserver/obj/viewserver/tsplib.o
tsplib.cpp:136: type specifier omitted for parameter
tsplib.cpp:136: parse error before numeric constant
tsplib.cpp: In function `int TSP_SendCommonTestOutSide(...)':
tsplib.cpp:150: `prCtxt' undeclared (first use this function)
tsplib.cpp:150: (Each undeclared identifier is reported only once for each
function it appears in.)
tsplib.cpp:156: `prCommonTESTOUTSIDE' undeclared (first use this function)
tsplib.cpp: At global scope:
tsplib.cpp:160: type specifier omitted for parameter
tsplib.cpp:160: parse error before numeric constant
tsplib.cpp: In function `int TSP_SendCommonResponse(...)':
tsplib.cpp:176: `ptCtxt' undeclared (first use this function)
tsplib.cpp:181: `prCommonResponse' undeclared (first use this function)
tsplib.cpp: In function `void TSP_OnRecvData(int, char*, int, char*, short
unsigned int)':
tsplib.cpp:243: `struct _TSP_CTXT' has no member named `sAreaCode'
tsplib.cpp:259: parse error before `*' token
tsplib.cpp:262: parse error before `*' token
tsplib.cpp: In function `int TSP_Init(int, char*)':
tsplib.cpp:294: parse error before `;' token
tsplib.cpp:295: parse error before `;' token
tsplib.cpp:301: parse error before `;' token
tsplib.cpp:302: parse error before `;' token
make[1]: *** [/home/vserver/obj/viewserver/tsplib.o] Error 1
make[1]: Leaving directory `/home/vserver/viewserver/tsp'
make: *** [ALL] Error 2
相关代码如下:
int TSP_SendMsg(int nHandle,char *pszMsgBuf,ushort nLen)
{
if ( g_rTSP.nMode == TSP_MODE_SERVER )
{
//printf("the pack len first is %dn",nLen);
return g_rTSP.rServer.SendMsg(nHandle,pszMsgBuf,nLen);
}
else
return g_rTSP.rClient.SendMsg(nHandle,pszMsgBuf,nLen);
}
int TSP_SendCommonTestOutSide(TSP_CTXT *prCtxt,TSP_Common_TESTOUTSIDE *prCommonTESTOUTSIDE);
{
char sTime[8];
char sTemp[40];
time_t temp;
time(&temp);
strcpy(sTemp,ctime(&temp));
strncpy(sTime,&sTemp[11],8);
sTime[8]='';
strcpy(g_rTSP.rSndPacket.rHeader.sLineType,"00");
sprintf(g_rTSP.rSndPacket.rHeader.sOrder,"%16s","TESTOUTSIDE");
strcpy(g_rTSP.rSndPacket.rHeader.sTaskID,prCtxt.sTaskID);
g_rTSP.rSndPacket.rHeader.nOrderSeq=prCtxt.OrderSeq;
strcpy(g_rTSP.rSndPacket.rHeader.sAreaCode,prCtxt.sAreaCode);
strcpy(g_rTSP.rSndPacket.rHeader.sSentTime,sTime);
sprintf(g_rTSP.rSndPacket.rHeader.nMsgBodyLen,"%08d",sizeof(TSP_Common_TESTOUTSIDE));
g_rTSP.rSndPacket.sTail=';';
memcpy(&g_rTSP.rSndPacket.sBody,(char *)prCommonTESTOUTSIDE,sizeof(TSP_Common_TESTOUTSIDE) );
return TSP_SendMsg(prCtxt->nHandle,(char*)&g_rTSP.rSndPacket,PACKET_HEAD_SIZE+sizeof(TSP_Common_TESTOUTSIDE)+1);
}
|
mark?