提问人:user2274060 提问时间:4/9/2018 最后编辑:user2274060 更新时间:4/9/2018 访问量:658
C/C++ WIN32 - Gecko - 集成网络浏览器
C/C++ WIN32 - Gecko - Integrate web browser
问:
我已经在Visual Studio中创建了一个用于C / C++的WIN32应用程序。然后,我去下面的地址下载了一个使用Gecko的例子:https://github.com/bnoordhuis/mozilla-central/tree/master/embedding/tests/winEmbed。
所以,我已经复制了我项目中的所有 *.cpp、*h、*.rc。然后,我编译了应用程序。但是我收到了 150 多个错误,因为依赖项错误等。所以,我已经下载了sdk xulrunner-41.0.2.en-us.win32.sdk.zip。我已经解压缩了文件。在我的项目(C/C++ >> General >> Additional Include Directories)的属性中,我添加了以下行:
$(ProjectDir);
$(ProjectDir)sdk\xulrunner-41.0.2.en-US.win32.sdk\xulrunner-sdk\include;
$(ProjectDir)sdk\xulrunner-41.0.2.en-US.win32.sdk\xulrunner-sdk\idl;
$(ProjectDir)sdk\xulrunner-41.0.2.en-US.win32.sdk\xulrunner-sdk\include\nspr\;
$(ProjectDir)sdk\xulrunner-41.0.2.en-US.win32.sdk\xulrunner-sdk\lib
但是我仍然有 45 个错误。这让我发疯。
这是错误:
Error (active) identifier "XRE_InitEmbedding2Type" is undefined WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 49
Error (active) identifier "XRE_TermEmbeddingType" is undefined WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 50
Error (active) argument of type "char *" is incompatible with parameter of type "LPWSTR" WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 171
Error (active) identifier "XPCOMGlueStartup" is undefined WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 178
Error (active) argument of type "char *" is incompatible with parameter of type "LPCWSTR" WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 184
Error (active) identifier "XRE_InitEmbedding2Type" is undefined WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 189
Error (active) expected a ';' WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 189
Error (active) identifier "XRE_TermEmbeddingType" is undefined WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 196
Error (active) expected a ';' WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 196
Error (active) no suitable conversion function from "nsGetterAddRefs<nsILocalFile>" to "nsIFile **" exists WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 208
Error (active) no suitable conversion function from "nsGetterAddRefs<nsILocalFile>" to "nsIFile **" exists WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 216
Error (active) a value of type "PRUint32" cannot be assigned to an entity of type "nsresult" WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 239
Error (active) return value type does not match the function type WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 244
Error (active) no instance of constructor "NS_ConvertASCIItoUTF16_external::NS_ConvertASCIItoUTF16_external" matches the argument list WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 535
Error (active) argument of type "const nsACString::char_type *" is incompatible with parameter of type "LPCWSTR" WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 925
Error (active) argument of type "const nsACString::char_type *" is incompatible with parameter of type "LPCWSTR" WinEmbed c:\Users\p4481680\Documents\WinEmbed\WinEmbed\WinEmbed.cpp 948
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? WinEmbed c:\users\p4481680\documents\winembed\winembed\windowcreator.cpp 54
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 49
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 50
Error C2146 syntax error: missing ';' before identifier 'XRE_InitEmbedding2' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 49
Error C2146 syntax error: missing ';' before identifier 'XRE_TermEmbedding' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 50
Error C2664 'DWORD GetModuleFileNameW(HMODULE,LPWSTR,DWORD)': cannot convert argument 2 from 'char [260]' to 'LPWSTR' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 171
Error C3861 'XPCOMGlueStartup': identifier not found WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 178
Error C2664 'HMODULE LoadLibraryExW(LPCWSTR,HANDLE,DWORD)': cannot convert argument 1 from 'char [260]' to 'LPCWSTR' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 184
Error C2659 '=': function as left operand WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 189
Error C2146 syntax error: missing ';' before identifier 'GetProcAddress' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 189
Error C2659 '=': function as left operand WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 196
Error C2146 syntax error: missing ';' before identifier 'GetProcAddress' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 196
Error C2664 'nsresult NS_NewNativeLocalFile(const nsACString &,bool,nsIFile **)': cannot convert argument 3 from 'nsGetterAddRefs<nsILocalFile>' to 'nsIFile **' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 208
Error C2664 'nsresult NS_NewNativeLocalFile(const nsACString &,bool,nsIFile **)': cannot convert argument 3 from 'nsGetterAddRefs<nsILocalFile>' to 'nsIFile **' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 216
Error C2440 'return': cannot convert from 'nsresult' to 'int' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 244
Error C2440 '=': cannot convert from 'PRUint32' to 'nsresult' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 239
Error C4996 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 161
Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 176
Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 182
Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 204
Error C2440 '<function-style-cast>': cannot convert from 'TCHAR [2048]' to 'NS_ConvertASCIItoUTF16_external' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 535
Error C2228 left of '.get' must have class/struct/union WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 535
Error C2664 'BOOL SetDlgItemTextW(HWND,int,LPCWSTR)': cannot convert argument 3 from 'const nsACString::char_type *' to 'LPCWSTR' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 925
Error C2664 'BOOL SetDlgItemTextW(HWND,int,LPCWSTR)': cannot convert argument 3 from 'const nsACString::char_type *' to 'LPCWSTR' WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 948
Error C2065 'PBM_SETRANGE': undeclared identifier WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 991
Error C4996 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 1065
Error C2065 'PBM_SETPOS': undeclared identifier WinEmbed c:\users\p4481680\documents\winembed\winembed\winembed.cpp 992
Error C4996 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. WinEmbed c:\users\p4481680\documents\winembed\winembed\sdk\xulrunner-41.0.2.en-us.win32.sdk\xulrunner-sdk\include\js\utility.h 155
Error C1083 Cannot open include file: 'nsIProfileChangeStatus.h': No such file or directory WinEmbed c:\users\p4481680\documents\winembed\winembed\webbrowserchrome.cpp 48
我还没有看到指示项目所有必要依赖项的文件。你有没有在任何地方看到所有必要的依赖项/文件都包含在项目中?我在操作过程中犯了错误吗?示例项目 WinEmbed 是否与我的 WIN32 应用程序兼容?
谢谢
答: 暂无答案
评论