解决方案 »

  1.   

    这个问题还没解决。但是在firefox源码里找到一个 nsSample ,位置:
    firefox-34.0.5.source\mozilla-release\xpcom\sample我使用 pyxpidl命令(header.py, typelib.py命令)在python 2.7.9环境下生成了相关代码文件。
    然后我使用了xulrunner sdk 34.0.5,里面的头文件与库文件,
    利用这些代码文件与库目录,我建立了VS2010的Win32 Dll工程,没有自定义任何 预处理器 项目,
    导入库“mozalloc.lib xpcomglue.lib”,因为没有 xpcom.lib,我也不知道该用哪个,但是这种设置链接不过去。
    错误提示:1>xpcomglue.lib(nsMemory.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>xpcomglue.lib(nsXPCOMGlue.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>xpcomglue.lib(nsStringAPI.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>xpcomglue.lib(FileUtils.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>xpcomglue.lib(nsCRTGlue.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>xpcomglue.lib(nsTArray.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(nsSample.obj 中)
    1>nsSample.obj : error LNK2001: 无法解析的外部符号 "public: virtual enum tag_nsresult __thiscall GenericClassInfo::QueryInterface(struct nsID const &,void * *)" (?QueryInterface@GenericClassInfo@@UAE?AW4tag_nsresult@@ABUnsID@@PAPAX@Z)
    1>nsSample.obj : error LNK2001: 无法解析的外部符号 "public: virtual unsigned int __thiscall GenericClassInfo::AddRef(void)" (?AddRef@GenericClassInfo@@UAEIXZ)
    1>nsSample.obj : error LNK2001: 无法解析的外部符号 "public: virtual unsigned int __thiscall GenericClassInfo::Release(void)" (?Release@GenericClassInfo@@UAEIXZ)
    (... 略)
    (我的感觉是 XPCOM 变化如此之快,试了好几个版本我都没有编译成功,即使编译成功也没应用成功过。。
     目前网上的教程都不适用当前的源码版本……头大啊)