所以我为rust设置了GTK-rs,我肯定做错了什么,因为当我试图运行我的代码时,它会返回这个错误,而我不知道如何修复它:
fatal error LNK1181: cannot open input file 'gtk-3.lib'
如果有帮助的话,我使用Eclipse IDE。
一些更多的数据可能会有所帮助:
我的环境变量是:
GTK_LIB_DIR=C:\msys64\mingw64\lib
PATH:
C:\msys64\mingw64\bin
C:\msys64\mingw64\include我的Cargo.toml文件:
[package]
name = "myapp"
version = "0.1.0"
authors = ["author"]
edition = "2018"
[dependencies.gtk]
version = "0.9.2"
features = ["v3_16"]
[dependencies]
glib = "0.10.2"
gio = "0.9.1"我使用了一些修改后的示例代码进行测试:
#![allow(non_snake_case)]
extern crate gtk;
extern crate glib;
extern crate gio;
use gio::prelude::*;
use glib::clone;
use gtk::prelude::*;
// When the application is launched…
fn on_activate(application: >k::Application) {
// … create a new window …
let window = gtk::ApplicationWindow::new(application);
// … with a button in it …
let button = gtk::Button::with_label("Hello World!");
// … which closes the window when clicked
button.connect_clicked(clone!(@weak window => move |_| window.close()));
window.add(&button);
window.show_all();
}
fn main() {
// Create a new application
let app = gtk::Application::new(Some("com.github.gtk-rs.examples.basic"), Default::default())
.expect("Initialization failed...");
app.connect_activate(|app| on_activate(app));
// Run the application
app.run(&std::env::args().collect::<Vec<_>>());
}发布于 2020-10-14 15:00:35
在使用gstreamer和gtk Rust绑定时,我遇到了与"link.exe“相同的问题。下面是我用来编译我的程序的方法。
除了检查"C++ Build tools“时安装的”default“工具之外,还可以下载微软的构建工具并安装以下工具。
MS Build Tools Options - credit https://github.com/rust-lang/rust/issues/44787
安装后,确保"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\bin\Hostx64\x64“”位于您的环境路径中。
重新启动电脑,然后再次尝试编译。希望它能起作用。但是,如果它仍然不支持,我建议从powershell卸载Rust
rustup self uninstall然后以这种方式从rustup.exe重新安装Rust。
默认主机三元组选项类型的
stable-x86_64-pc-windows-gnu
对于rest和continue installation.,请按enter键以选择“
重新启动你的电脑,程序肯定会被编译。
https://stackoverflow.com/questions/64219095
复制相似问题