linux下编译文件的时候出现error: expected identifier before ‘(’ token问题 35
在linux下编译文件的时候出现/home/ctsdev/biz/src/include/kdexcept.h:42:error:expectedidentifierbe...
在linux下编译文件的时候出现
/home/ctsdev/biz/src/include/kdexcept.h:42: error: expected identifier before ‘(’ token
/home/ctsdev/biz/src/include/kdexcept.h:42: error: expected ‘,’ or ‘...’ before ‘&’ token
问题,然后我找到了kdexcept.cpp文件,里面的完整程序如下
#include <string.h>
#include "kdexcept.h"
CKDExcept::CKDExcept(const long p_lMsgNo,
const char *p_lpszLbmCode, const char *p_lpszClassName,
const char *p_lpszSubMsg1, const char *p_lpszSubMsg2,
const char *p_lpszSubMsg3, const char *p_lpszSubMsg4)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
if (p_lpszLbmCode != NULL)
{
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
}
if (p_lpszClassName != NULL)
{
strncpy(m_szClassName, p_lpszClassName, sizeof(m_szClassName));
}
g_clKDMsg.SetMsg(p_lMsgNo, p_lpszSubMsg1, p_lpszSubMsg2, p_lpszSubMsg3, p_lpszSubMsg4);
if (p_lMsgNo >= KD_MSG_FATAL_CODE_FLOOR && p_lMsgNo <= KD_MSG_FATAL_CODE_CEILING)
{
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
}
else
{
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
}
CKDExcept::CKDExcept(const long p_lSqlMsgNo,
struct sqlca &p_refStSqlca, const char *p_lpszSqlCmd,
const char *p_lpszLbmCode, const char *p_lpszClassName)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
if (p_lpszLbmCode != NULL)
{
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
}
if (p_lpszClassName != NULL)
{
strncpy(m_szClassName, p_lpszClassName, sizeof(m_szClassName));
}
g_clKDMsg.SetSqlMsg(p_lSqlMsgNo, p_refStSqlca, p_lpszSqlCmd);
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
CKDExcept::CKDExcept(const char *p_lpszLbmCode)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
CKDExcept::~CKDExcept()
{
}
char *CKDExcept::GetLbmCode()
{
return m_szLbmCode;
}
char *CKDExcept::GetClassName()
{
return m_szClassName;
}
网上差资料说是有一定可能是因为里面的宏定义出现冲突了,我看了一下还是没分析出来,有哪位大哥能帮帮忙看看是哪儿的问题啊、
不好意思应该是发.h的文件,报错在kdexcept.h我补充一下kdexcept.h的文件信息
#ifndef __KDEXCEPT_H
#define __KDEXCEPT_H
#include <sqlca.h>
#include <sql.h>
#include <sqlenv.h>
#include "kdmsg.h"
#include "global.h"
class CKDExcept
{
public:
CKDExcept(const long p_lMsgNo,
const char *p_lpszLbmCode = NULL,
const char *p_lpszClassName = NULL,
const char *p_lpszSubMsg1 = NULL,
const char *p_lpszSubMsg2 = NULL,
const char *p_lpszSubMsg3 = NULL,
const char *p_lpszSubMsg4 = NULL);
CKDExcept(const long p_lMsgNo,
struct sqlca &p_refstSqlca,
const char *p_lpszSqlCmd = NULL,
const char *p_lpszLbmCode = NULL,
const char *p_lpszClassName = NULL);
CKDExcept(const char *p_lpszLbmCode = NULL);
~CKDExcept();
char *GetLbmCode();
char *GetClassName();
private:
char m_szLbmCode[32];
char m_szClassName[32];
};
#endif // __KDEXCEPT_H 展开
/home/ctsdev/biz/src/include/kdexcept.h:42: error: expected identifier before ‘(’ token
/home/ctsdev/biz/src/include/kdexcept.h:42: error: expected ‘,’ or ‘...’ before ‘&’ token
问题,然后我找到了kdexcept.cpp文件,里面的完整程序如下
#include <string.h>
#include "kdexcept.h"
CKDExcept::CKDExcept(const long p_lMsgNo,
const char *p_lpszLbmCode, const char *p_lpszClassName,
const char *p_lpszSubMsg1, const char *p_lpszSubMsg2,
const char *p_lpszSubMsg3, const char *p_lpszSubMsg4)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
if (p_lpszLbmCode != NULL)
{
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
}
if (p_lpszClassName != NULL)
{
strncpy(m_szClassName, p_lpszClassName, sizeof(m_szClassName));
}
g_clKDMsg.SetMsg(p_lMsgNo, p_lpszSubMsg1, p_lpszSubMsg2, p_lpszSubMsg3, p_lpszSubMsg4);
if (p_lMsgNo >= KD_MSG_FATAL_CODE_FLOOR && p_lMsgNo <= KD_MSG_FATAL_CODE_CEILING)
{
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
}
else
{
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
}
CKDExcept::CKDExcept(const long p_lSqlMsgNo,
struct sqlca &p_refStSqlca, const char *p_lpszSqlCmd,
const char *p_lpszLbmCode, const char *p_lpszClassName)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
if (p_lpszLbmCode != NULL)
{
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
}
if (p_lpszClassName != NULL)
{
strncpy(m_szClassName, p_lpszClassName, sizeof(m_szClassName));
}
g_clKDMsg.SetSqlMsg(p_lSqlMsgNo, p_refStSqlca, p_lpszSqlCmd);
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
CKDExcept::CKDExcept(const char *p_lpszLbmCode)
{
memset((void *)m_szLbmCode, 0x00, sizeof(m_szLbmCode));
memset((void *)m_szClassName, 0x00, sizeof(m_szClassName));
strncpy(m_szLbmCode, p_lpszLbmCode, sizeof(m_szLbmCode));
#ifdef KD_DEBUG
g_clKDMsg.WriteLog(m_szLbmCode, m_szClassName);
#endif
}
CKDExcept::~CKDExcept()
{
}
char *CKDExcept::GetLbmCode()
{
return m_szLbmCode;
}
char *CKDExcept::GetClassName()
{
return m_szClassName;
}
网上差资料说是有一定可能是因为里面的宏定义出现冲突了,我看了一下还是没分析出来,有哪位大哥能帮帮忙看看是哪儿的问题啊、
不好意思应该是发.h的文件,报错在kdexcept.h我补充一下kdexcept.h的文件信息
#ifndef __KDEXCEPT_H
#define __KDEXCEPT_H
#include <sqlca.h>
#include <sql.h>
#include <sqlenv.h>
#include "kdmsg.h"
#include "global.h"
class CKDExcept
{
public:
CKDExcept(const long p_lMsgNo,
const char *p_lpszLbmCode = NULL,
const char *p_lpszClassName = NULL,
const char *p_lpszSubMsg1 = NULL,
const char *p_lpszSubMsg2 = NULL,
const char *p_lpszSubMsg3 = NULL,
const char *p_lpszSubMsg4 = NULL);
CKDExcept(const long p_lMsgNo,
struct sqlca &p_refstSqlca,
const char *p_lpszSqlCmd = NULL,
const char *p_lpszLbmCode = NULL,
const char *p_lpszClassName = NULL);
CKDExcept(const char *p_lpszLbmCode = NULL);
~CKDExcept();
char *GetLbmCode();
char *GetClassName();
private:
char m_szLbmCode[32];
char m_szClassName[32];
};
#endif // __KDEXCEPT_H 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询