我遇到了一个问题:我的代码在CentOS g ++中运行良好,但是当我在visual studio 2008中编译它们时,visual studio会告诉我下面的错误:
1.c:\ program files(x86)\ microsoft visual studio 9.0 \ vc \ include \ codeanalysis \ sourceannotations.h(19):错误C2144:语法错误:'__ w64 unsigned int'前面应加'}'
2.error C2143:语法错误:在'namespace'之前缺少'}'。
我的文件编码是UTF-8。我应该在Unicode中更改它们,我在Unicode中更改了一些错误文件,它仍然有如上所述的错误。
下面是一些sourecode:#ifndef ENRC_CODE_DEFS_H
#define ENRC_CODE_DEFS_H
enum ENReturnCode
{
ENRC_SUCCESS = 0,
ENRC_FAILED,
ENRC_NODATA,
ENRC_CONFIG_NOT_AVAILABLE,
ENRC_INVALID_SUBSCRIBE_ID,
ENRC_INVALID_SUBSCRIBE_CONDITION,
ENRC_INVALID_SUBSCRIBER,
ENRC_INVALID_PARAMETER,
ENRC_THREAD_RUNNING,
ENRC_SUBSCRIBE_LIST_EMPTY,
ENRC_OUT_OF_MEMORY // 10
}
e:\my_code\cppcommon\include\errordefs.h(5) : error C2143: syntax error : missing ';' before 'enum [tag]'
下:
#ifndef EN_SMS_SRC_TAO2CPP_H_
#define EN_SMS_SRC_TAO2CPP_H_
#include "SystemMonitorMasterServiceC.h"
#include "SystemMonitorSlaveServiceC.h"
#include "CommonDefs.h"
#include "SystemMonitorServiceDataDefs.h"
namespace EN
{
namespace SMS
{
template < typename _Ty, typename _Cy>
inline
void Tao2Cpp_Enum(_Ty taoValue, _Cy &cppValue)
{
cppValue = (_Cy)taoValue;
}
error C2143: syntax error : missing '}' before 'namespace'
上面有很多错误。
感谢。我浪费了一些时间让它易于阅读。
答案 0 :(得分:0)
你需要在枚举声明中使用分号:
enum ENReturnCode
{
...
};