2011-06-17 37 views
0

好了,遷移到Gecko 2.0後,我的XPCOM組件, 我修復瞭如下幾個問題: 1.將#include「nsIGenericFactory.h」替換爲#include「mozilla /ModuleUtils.h「 2.將xpcomglue_s.lib替換爲xpcomglue_s_nomozalloc.lib 3.將#include」mozilla-config.h「添加到xpcom-config.h頭文件 4.並且除去一對未使用的頭文件文件,例如:nsReadableUtils.h,nsEventQueueUtils.h,nsIExtensionManager.h 5.替換NS_DEFINE_STATIC_IID_ACCESSOR(IMYPROGRAM_IID)到NS_DEFINE_STATIC_IID_ACCESSOR(IMyProgram,IMYPROGRAM_IID)將Gecko 1.9遷移到2.0 - 很多錯誤

從200+è減少現在到20+的錯誤,下面是幾個我不知道那是什麼的錯誤,這裏的任何專家遇到像下面這樣的問題?

error C3254: 'IMyProgram' : class contains explicit override 'kIID' but does not derive from an interface that contains the function declaration 
error C2838: 'kIID' : illegal qualified name in member declaration 
error C3857: 'IMyProgram::kIID': multiple template parameter lists are not allowed 
error C2084: function 'void nsTraceRefcnt::LogAddRef(void *,nsrefcnt,const char *,PRUint32)' already has a body 
error C2084: function 'void nsTraceRefcnt::LogRelease(void *,nsrefcnt,const char *)' already has a body 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2143: syntax error : missing ',' before '*' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2143: syntax error : missing ',' before '*' 
error C2146: syntax error : missing ';' before identifier 'components' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2440: 'initializing' : cannot convert from 'const char [13]' to 'int' 
error C2078: too many initializers 
error C2448: 'NS_IMPL_NSGETMODULE' : function-style initializer appears to be a function definition 
error C2143: syntax error : missing ';' before '__stdcall' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2143: syntax error : missing ',' before '*' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2556: 'int MyProgramRegistration(nsIComponentManager *,nsIFile *,const char *,const char *,const int)' : overloaded function differs only by return type from 'nsresult MyProgramRegistration(nsIComponentManager *,nsIFile *,const char *,const char *,const int)' 
error C2371: 'MyProgramRegistration' : redefinition; different basic types 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
error C2143: syntax error : missing ',' before '*' 
error C3254: 'IMyProgram' : class contains explicit override 'kIID' but does not derive from an interface that contains the function declaration 
error C2838: 'kIID' : illegal qualified name in member declaration 
error C3857: 'IMyProgram::kIID': multiple template parameter lists are not allowed 
+0

如果您使用VS 2010,請嘗試添加這些預處理器定義XPCOM_GLUE_USE_NSPR; XPCOM_GLUE_S並鏈接到xpcomglue_s.lib; xpcom.lib; nspr4.lib這些庫。 – atVelu 2011-06-19 09:12:04

回答

0

在它看來,如果你缺少你的接口的NS_DECLARE_STATIC_IID_ACCESSOR(IMYPROGRAM_IID)(XPIDL會生成自動爲您。)一些其他錯誤更難一點要弄清楚沒有源代碼,最起碼,但有可能你沒有完全地正確地更新你的模塊註冊碼。