webview / webview_go

Go language bindings for the webview library.
MIT License
176 stars 27 forks source link

Could not import github.com/webview/webview_go #12

Closed zhanxiaox closed 9 months ago

zhanxiaox commented 9 months ago

err

SteffenL commented 9 months ago

Can you build one of the examples using the instructions provided in the readme file?

zhanxiaox commented 9 months ago

err I searched for the relevant error reasons. Is it necessary to have the GCC environment and enable CGO_ENABLED?

zhanxiaox commented 9 months ago

err I searched for the relevant error reasons. Is it necessary to have the GCC environment and enable CGO_ENABLED?

err2 I have installed gcc and config CGO_ENABLED=1 to build examples, but I encountered more issues. Did I do something wrong?

SteffenL commented 9 months ago

There are some cases where CGO_ENABLED isn't set to 1 by default and in those cases you need to set it to 1 by yourself. You can check the documentation of cgo.

The error doesn't seem related to the core webview library. Are you compiling with a Cygwin environment? If so then I suggest trying e.g. MSYS2 or WinLibs instead.

If you want to keep using Cygwin then please know that I haven't personally tested with it. Also, are you sure you don't need to compile inside a special Cygwin shell/terminal rather than with PowerShell?

zhanxiaox commented 9 months ago

Ok,Thank you very much,Use MSYS2 install gcc environment,Examples worked now,And in MSYS2's shell seem can't load system's path,I have added MSYS2/bin to the system's path.

SteffenL commented 9 months ago

I'm glad that works although it may be a good idea to choose a specific MSYS2 environment such as UCRT64, MINGW64 or CLANG64.

Can we can close this issue?