[英]C++ code compiles in CentOS g++, but not in Visual studio 2008
我有一個問題:我的代碼在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.錯誤C2143:語法錯誤:“名稱空間”前缺少“}”。
我的文件編碼是UTF-8。 如果我全部更改為Unicode,我更改了Unicode中的一些錯誤文件,它仍然存在上述錯誤。
以下是一些源代碼:
#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'
像上面的很多錯誤。
謝謝。 我花一些時間使它易於閱讀。
您需要在枚舉聲明中使用分號:
enum ENReturnCode
{
...
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.