nsiCookieManager2 程序缺少符号
请帮助我解决此 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不在于库,缺少的符号是在 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 expectsunsigned char
where Mozilla hasunsigned int
. I suspect that the reason is you compiling your application without Unicode support - changemain()
intowmain()
?