nsiCookieManager2 程序缺少符号

发布于 2024-12-29 00:27:06 字数 2147 浏览 1 评论 0原文

请帮助我解决此 MOZILLA 程序缺少的 LIB。 尝试使用 nsICookieManager2 创建 cookie 我已尝试使用 Mozilla SDK 中的所有现有库 问候

C:\Code>cl.exe FFCookie.cpp /I "C:\xulrunner-sdk\include" mozalloc.lib xpcomglue.lib /link /LIBPATH:"C:\xulrunner-sdk\lib"

符号丢失:

FFCookie.obj:错误 LNK2019:无法解析的外部符号“public:void __thiscall nsCOMPtr_base::assign_from_gs_contractid_with_er ror(class nsGetServiceByContractIDWithError const &,struct nsID const &)" (?assign_from_gs_contractid_with_error@nsCOMPtr_base@@QA EXABVnsGetServiceByContractIDWithError@@ABUnsID@@@Z) 中引用 函数“公共:__thiscall nsCOMPtr:: nsCOMPtr(类 nsGetServiceByContractIDWithError const &)" (??0?$nsCOMPtr@VnsICookieManager@@@@QAE@ABVnsGe tServiceByContractIDWithError@@@Z)

FFCookie.obj:错误 LNK2019:无法解析的外部符号“public:void __thiscall nsCOMPtr_base::assign_from_qi(class nsQueryInterface,struct nsID const &)" (?assign_from_qi@nsCOMPtr_base@@QAEXVnsQueryInterface@@ABUnsID@@@Z) 在函数“public: __t hiscall nsCOMPtr::nsCOMPtr(class nsQueryInterface)" (??0?$nsCOMPtr@VnsICookieMan ager2@@@@QAE@VnsQueryInterface@@@Z) FFCookie.exe:致命错误 LNK1120:2 个未解析的外部

#include "nsICookieManager.h"
#include "nsICookieManager2.h"
#include "nsServiceManagerUtils.h"
#include "nsComPtr.h"
#include "nsNetCID.h"
#include "nsStringAPI.h"
#include "mozilla-config.h"
int main()
{

    nsresult rv;
    nsCOMPtr<nsICookieManager> cookieManager = do_GetService (NS_COOKIEMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);

    if (cookieManager)
    {
      nsCOMPtr<nsICookieManager2> cookieManager2 = do_QueryInterface(cookieManager);
      if (cookieManager2)
      {
        cookieManager2->Add(NS_LITERAL_CSTRING("ud.abc.com"),
                       NS_LITERAL_CSTRING("//"),
                       NS_LITERAL_CSTRING("TK"),
                       NS_LITERAL_CSTRING("abc"),  0x1, 0x1, 0, -1);

      }
    }
    return 0;
}

问题:

我没有找到任何关于要包含哪个 LIB 的函数文档信息(正如我在 MSDN 上找到的)

有关如何找出与 MOZILLA 特定函数相对应的 LIB 的任何线索。

Please help me with the missing LIBs for this MOZILLA program.
Trying to create cookie using nsICookieManager2
I have tried with all the existing libs in Mozilla SDK
Regards

C:\Code>cl.exe FFCookie.cpp /I "C:\xulrunner-sdk\include" mozalloc.lib xpcomglue.lib /link /LIBPATH:"C:\xulrunner-sdk\lib"

Symbols Missing:

FFCookie.obj : error LNK2019: unresolved external symbol "public: void
__thiscall nsCOMPtr_base::assign_from_gs_contractid_with_er ror(class nsGetServiceByContractIDWithError const &,struct nsID const &)"
(?assign_from_gs_contractid_with_error@nsCOMPtr_base@@QA
EXABVnsGetServiceByContractIDWithError@@ABUnsID@@@Z) referenced in
function "public: __thiscall nsCOMPtr::
nsCOMPtr(class
nsGetServiceByContractIDWithError const &)"
(??0?$nsCOMPtr@VnsICookieManager@@@@QAE@ABVnsGe
tServiceByContractIDWithError@@@Z)

FFCookie.obj : error LNK2019: unresolved external symbol "public: void
__thiscall nsCOMPtr_base::assign_from_qi(class nsQueryInter face,struct nsID const &)"
(?assign_from_qi@nsCOMPtr_base@@QAEXVnsQueryInterface@@ABUnsID@@@Z)
referenced in function "public: __t hiscall nsCOMPtr::nsCOMPtr(class
nsQueryInterface)" (??0?$nsCOMPtr@VnsICookieMan
ager2@@@@QAE@VnsQueryInterface@@@Z) FFCookie.exe : fatal error
LNK1120: 2 unresolved externals

#include "nsICookieManager.h"
#include "nsICookieManager2.h"
#include "nsServiceManagerUtils.h"
#include "nsComPtr.h"
#include "nsNetCID.h"
#include "nsStringAPI.h"
#include "mozilla-config.h"
int main()
{

    nsresult rv;
    nsCOMPtr<nsICookieManager> cookieManager = do_GetService (NS_COOKIEMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);

    if (cookieManager)
    {
      nsCOMPtr<nsICookieManager2> cookieManager2 = do_QueryInterface(cookieManager);
      if (cookieManager2)
      {
        cookieManager2->Add(NS_LITERAL_CSTRING("ud.abc.com"),
                       NS_LITERAL_CSTRING("//"),
                       NS_LITERAL_CSTRING("TK"),
                       NS_LITERAL_CSTRING("abc"),  0x1, 0x1, 0, -1);

      }
    }
    return 0;
}

Questions:

I dont find any info with function documentation regarding which LIB to include (as I find on MSDN)

Any clue on how to figure out LIB corresponding to particular function for MOZILLA.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追星践月 2025-01-05 00:27:06

问题不在于库,缺少的符号是在 xpcomglue 库中定义的。但是,您似乎有一些编译参数与用于编译 XULRunner/Firefox 的参数不匹配。您的编译器正在查找的符号包含“QAEX”作为参数描述,而库则使用“QAIX”定义它们。查看名称修改表,您的编译器需要 unsigned char 其中 Mozilla 有 unsigned int。我怀疑原因是您在没有 Unicode 支持的情况下编译应用程序 - 将 main() 更改为 wmain()

The problem isn't with the lib, the symbol missing is defined in the xpcomglue library. However, you seem to have some compile parameters that don't match the parameters used to compile XULRunner/Firefox. The symbols your compiler is looking for contain "QAEX" as parameter description whereas the library defines them with "QAIX". Looking at the name mangling table, your compiler expects unsigned char where Mozilla has unsigned int. I suspect that the reason is you compiling your application without Unicode support - change main() into wmain()?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文