货物运行忽略了货物构建指定的功能

时间:2017-06-08 17:44:55

标签: rust

我已经用这种方式编译了Rust GTK examples

$ cargo build --features gtk_3_10

当我尝试运行该示例时,会发生错误:

   $ cargo run --bin gtktest   
    Compiling gtk-rs-examples v0.0.1 (file:///home/me123/rust/gtk_examples)
    Finished dev [unoptimized + debuginfo] target(s) in 0.39 secs
     Running `target/debug/gtktest`
This example only work with GTK 3.10 and later
Did you forget to build with `--features gtk_3_10`?

如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

调用cargo run时需要传递这些功能:

cargo run --bin gtktest --features gtk_3_10

您还可以在构建后直接运行可执行文件:

$ cargo build --bin gtktest --features gtk_3_10
$ ./target/debug/gtktest

您可以判断您的命令没有按预期执行,因为输出显示您的代码正在重新编译:

Compiling gtk-rs-examples v0.0.1 (file:///home/me123/rust/gtk_examples)
相关问题