webview / webview

Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).

Home Page:https://webview.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build example on Windows

justlearn2140 opened this issue · comments

Hello, long time no see,

A while ago, I was working on webkit-related development on Linux, but I found that it doesn't work on Windows.

Currently, I'd like to address two aspects:

Firstly, I would like to compile webkit on Windows, as discussed in #927. I didn't end up using the #WEBVIEW_EDGE approach.

Secondly, I have Visual Studio 2022 and MSYS2 installed on my Windows machine. I've followed the examples on the website, but I'm still unable to compile successfully. I'm not sure where the issue lies and would greatly appreciate your assistance.

Thank you very much.

What OS are you using (uname -a, or Windows version)?

Windows Server 2022 Standard

What programming language are you using (C/C++/Go/Rust)?

#gcc --version
gcc.exe (Rev7, Built by MSYS2 project) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you expect to see and what you saw instead?

I made the following changes in basic.cc
w.navigate("https://en.wikipedia.org/wiki/WebView");
//w.set_html("Thanks for using webview!");

A. Then, I compiled and ran basic.exe in MSYS2. But the window that popped up was entirely white, and the wiki page didn't appear.

#Windows/MinGW
g++ basic.cc -std=c++14 -mwindows -Ilibs/webview -Ilibs/webview2/build/native/include -ladvapi32 -lole32 -lshell32 -lshlwapi -luser32 -lversion -o build/basic.exe && "build/basic.exe"

B. The same issue occurred in the Developer Command Prompt for VS 2022 environment. After compiling and running the file, it still didn't load the wiki page; it remained all white.

#[Bonus for Visual C++]
Build a C++ example:

C:\WebView\my-project>cl basic.cc /std:c++14 /EHsc /Fobuild\ ^
More? /I libs\webview ^
More? /I libs\webview2\build\native\include ^
More? /link /OUT:build\basic.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32825 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

basic.cc
Microsoft (R) Incremental Linker Version 14.37.32825.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:basic.exe
/OUT:build\basic.exe
build\basic.obj