我已经在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>>其他包含目录)中,我添加了以下行:
$(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应用程序兼容?
谢谢