Firefox 26 C++ Addon XPCOM dependency error

蓝咒 提交于 2019-12-13 05:09:22

问题


I prepare my C++ Firefox addon for the next Firefox - v.26 - but I can't build it with xulrunner-sdk 26 beta (it is OK with the previous major versions). Just as before, I link it against xpcomglue_staticruntime_s.lib, but I've got these errors:

  • xpcomglue_staticruntime_s.lib(nsStringAPI.obj) : error LNK2019: unresolved external symbol _imp_PR_sscanf referenced in function "public: __int64 __thiscall nsAString::ToInteger64(enum tag_nsresult *,unsigned int)const " (?ToInteger64@nsAString@@QBE_JPAW4tag_nsresult@@I@Z)

  • xpcomglue_staticruntime_s.lib(nsCRTGlue.obj) : error LNK2019: unresolved external symbol _imp_PR_Now referenced in function "void __cdecl NS_MakeRandomString(char *,int)" (?NS_MakeRandomString@@YAXPADH@Z)

I added all other libraries from this SDK (not only xul.lib and mozalloc.lib but also crmf.lib etc.), it doesn't help. Neither works using xpcomglue_s.lib or xpcomglue_s_nomozalloc.lib instead of xpcomglue_staticruntime_s.lib

Now I can build the addon successfuly only if I use xpcomglue.lib or xpcomglue_staticruntime.lib, but then it doesn't work correctly with Firefox - NS_GetServiceManager() fails. There are some linker warnings with these builds.

What settings I need to make it linking against xpcomglue_staticruntime_s.lib or working in other cases?

Platform: MS Windows, MS Visual Studio 2010.

Two details more:

  • In previous sdk versions there was nss3.lib and I added it, now it is missing
  • I use the default mozilla-config.h and xpcom-config.h, plus MOZILLA_STRICT_API macro

回答1:


It is confirmed bug in the SDK. A fix is planned for Mozilla 28 (OMG!) For details watch here: https://bugzilla.mozilla.org/show_bug.cgi?id=937005

In meantime I found that I can use nss3.lib from older versions, tested with this one: http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/25.0.1/sdk/xulrunner-25.0.1.en-US.win32.sdk.zip



来源:https://stackoverflow.com/questions/20190810/firefox-26-c-addon-xpcom-dependency-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!