windows - 在 Windows 上安装 Rust 以开发 GUI 应用程序

标签 windows user-interface rust

TL:DR;

我可以在 Win 10 (64) 上使用 Rust 编写 GUI 程序而不安装完整的 MinGW 工具链(也不是 MS 等效工具)吗?

<子> 补充问题:

<子> - 如果没有,我应该继续安装 MinGW 吗?

<子> - Windows 10 周年更新 中的 GNUish 有什么改变吗?


更长的版本

saw 15 分钟前,Rust 是这里最受欢迎的编程语言......

read

No additional software installation is necessary for basic use of the GNU build.

Rust's support for the GNU ABI is more mature, and is recommended for typical uses.

所以我将 Windows (GNU ABI †) (.msi) 64 位 下载到运行 Windows 10 的电脑上。

途易

我阅读了一些基本介绍并使用 rustc 编译了一个 Hello World!并运行正常。然后我阅读了有关 cargo 的内容并重新组织了 buit 并使用它运行了相同的代码。

界面

然后我搜索了 Rust GUI 并找到了 Kiss_UI

a simple UI tookit for Rust

所以我做了一个 cargo new Hello_GUI --bin 并添加了

[dependencies.kiss-ui]
git = "https://github.com/cybergeek94/kiss-ui"

到 Cargo.toml

我从该网站剪切并粘贴了一个简单示例到 main.rs

然后我运行了 cargo run --verbose。做到了

   Updating git repository `https://github.com/cybergeek94/kiss-ui`
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading iup-sys v0.0.3
 Downloading libc v0.2.14
 Downloading libc v0.1.12
   Compiling libc v0.1.12

...

warning: crate `Hello_GUI` should have a snake case name such as `hello_gui`, #[warn(non_snake_case)] on by default
error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" ...
note: ld: cannot find -liup
error: aborting due to previous error

所以我学到了两件事

  • 我需要使用蛇形外壳。

  • GUI编程不是“基本使用”。

我对这两点都没有提示,但可以使用一两个关于第二点的线索:

假设我想以一种简单的方式编写一个相当于 Hello World 的 GUI,现在我的主要选择是什么?

最佳答案

According to its documentation , kiss-UI 依赖the IUP library .

gcc 的错误(找不到 -liup)表明您没有安装 IUP。您也许可以安装它并使它正常工作;这取决于 IUP bindings used by kiss-UI 是否可以应付 window 。

一些其他的 GUI 库可以在 awesome-rust 找到.有与 Qt 和 Gtk 等库的绑定(bind)。如果您了解 Windows API,您还可以查看 winapi crate .

如果你想避免弄乱链接和其他东西,你可以尝试使用像 conrod 这样的纯 Rust 库。 ,它应该在 Windows 上“正常工作”。

回答您更广泛的问题:

参见 footnote在下载页面上。 Rust 的 MSVC 版本取决于安装的 MSVC。 GNU/MinGW 构建是独立的。

关于windows - 在 Windows 上安装 Rust 以开发 GUI 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38775792/

相关文章:

在 Pascal 中更改二维指针

Python 打印带有\u 转义的 json,解码错误

c# - 删除按钮的蓝色轮廓

arrays - 将数组分配到运行时已知大小的堆上

c++ - 写入后跨进程读取文件一致性

c - 打开USB通讯

cocoa - 最小绘画程序的示例代码(MS Paint 风格)

java - 如何在没有 Eclipse 的情况下使用 SWT?

rust - 为什么添加 byteorder 会使 Cargo 将 mysql 降级到 8.0.0 版本?

testing - 使用 cargo 运行测试时如何忽略示例?