Closed jayaganeshk closed 1 year ago
I have this problem too.
i downgraded the version to 0.2.1. Seems to be working fine on 0.2.1 version. @riccardo-lomazzi
This seems to be a Visual Studio problem. I built my app and it worked. Changed nothing but upgraded Visual Studio to 17.6 and I got this error. Also VS 17.6.1 and the 17.7 preview had this error.
As you said, downgrading this package to 0.2.1 worked.
So somehow 0.2.2 and VS 17.6 don't go along. (I don't know what VS version I had prior to 17.6, so can't really say which version worked.)
Downgrading works in Debug
, but not in Release
.
fatal error C1083: Cannot open include file: 'wil/com.h': No such file or directory [D:\Apps\exampleapp\build\windows\plugins\webview_windows\webview_windows_plugin.vcxproj]
Downgrading works in
Debug
, but not inRelease
.
fatal error C1083: Cannot open include file: 'wil/com.h': No such file or directory [D:\Apps\exampleapp\build\windows\plugins\webview_windows\webview_windows_plugin.vcxproj]
I've managed to make it work. Here's what I did.
The problem lies in the fact that the wil
library (Windows Implementation Library
) is missing from the plugin compilation, for some reason.
You cannot add it to the built plugin project, as it deleted and recompiled everytime.
As you may know, the plugin's Additional Include Directories
also look inside the project's windows/flutter/ephemeral
folder, which is deleted after every flutter clean
.
My solution was to modify the CMakeLists.txt
file to copy the library in the ephemeral
folder at every build.
So,
Windows Implementation Library
by nuget (link)%userprofile%/.nuget/packages/microsoft.windows.implementationlibrary/1.0.220914.1/include
folder.wil
folder inside the project's windows/runner/resources/
windows/flutter/CMakeLists.txt
by inserting the following lines.
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
file(COPY "${PROJECT_DIR}/windows/runner/resources/wil" DESTINATION "${EPHEMERAL_DIR}/")
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
Hope it helps until the `0.2.2` version will work with a future VS2022 release.
While Running facing below error. Flutter verion: 3.7.5 Visual Studio: 2022
[ +685 ms] std.ixx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (__imp_?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA::<!std>) referenced in function "public: void __cdecl stdext::exception::_Raise(void)const " (?_Raise@exception@stdext@@QEBAXXZ::<!std>) [C:\Users\Administrator\Documents\codecommit\url_host\build\windows\plugins\webview_windows\webview_windows_plugin.vcxproj]
version 0.2.2, change file CMakeLists.txt, line 77, target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_23) to target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_20) can solve this problem
While Running facing below error. Flutter verion: 3.7.5 Visual Studio: 2022
[ +685 ms] std.ixx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (__imp_?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA::<!std>) referenced in function "public: void __cdecl stdext::exception::_Raise(void)const " (?_Raise@exception@stdext@@QEBAXXZ::<!std>) [C:\Users\Administrator\Documents\codecommit\url_host\build\windows\plugins\webview_windows\webview_windows_plugin.vcxproj]
version 0.2.2, change file CMakeLists.txt, line 77, target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_23) to target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_20) can solve this problem
This worked for me... Thanks a lot
VS 17.5.3 is a version where this was still working, but it might be caused by a bug fixed ;-)
When encountering the given error while running, with Flutter version 3.7.5 and Visual Studio 2022, modifying line 77 in the CMakeLists.txt file of version 0.2.2 can resolve the issue. Specifically, changing "target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_23)" to "target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_20)" provides a successful solution.
I cannot find that particular CMakeLists.txt file, where is it located?
Tôi không thể tìm thấy tệp cụ thể CMakeLists.txt đó, nó nằm ở đâu?
you search in C:\Users\Admin\AppData\Local\Pub\Cache\hosted\pub.dev\webview_windows-0.2.2\windows
Ok, that worked for me. When can we expect an update to the plugin?
While Running facing below error. Flutter verion: 3.7.5 Visual Studio: 2022