缺少nsiCookieManager2程序的符号

时间:2012-01-23 16:01:53

标签: firefox xul

请帮助我解决此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)   功能“public:__ thiscall nsCOMPtr ::   nsCOMPtr的(类   nsGetServiceByContractIDWithError const&)“   (φ0 $ @ nsCOMPtr的@@@@ VnsICookieManager QAE @ ABVnsGe   tServiceByContractIDWithError @@@ Z)

     

FFCookie.obj:错误LNK2019:未解析的外部符号“public:void   __thiscall nsCOMPtr_base :: assign_from_qi(类nsQueryInter face,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的任何线索。

1 个答案:

答案 0 :(得分:0)

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