0

我正在尝试使用 Conrod将 GUI 添加到我的一个小项目中。我设法解决了 3 个编译错误:

error[E0433]: failed to resolve. Could not find `glutin` in `glium`
  --> src/support/mod.rs:88:53
   |
88 |     pub fn next(&mut self, events_loop: &mut glium::glutin::EventsLoop) -> Vec<glium::glutin::Event> {
   |                                                     ^^^^^^ Could not find `glutin` in `glium`

error[E0433]: failed to resolve. Could not find `glutin` in `glium`
  --> src/support/mod.rs:88:87
   |
88 |     pub fn next(&mut self, events_loop: &mut glium::glutin::EventsLoop) -> Vec<glium::glutin::Event> {
   |                                                                                       ^^^^^^ Could not find `glutin` in `glium`

error[E0433]: failed to resolve. Could not find `glutin` in `glium`
   --> src/support/mod.rs:106:24
    |
106 |                 glium::glutin::ControlFlow::Break
    |                        ^^^^^^ Could not find `glutin` in `glium`

我研究了 Conrod 附带的示例(尤其是text_edit.rs示例),并成功编译并运行了它们。据我所知,他们使用相同的技术(因为我的代码直接受到他们示例的启发),但不会受到未解决的glutin.

此外,我似乎glutin在项目目录本身中找不到任何引用:

$> pwd
~/dev/conrod/src
$> tree.
    .
├── backend
│   ├── gfx.rs
│   ├── glium.rs
│   ├── mod.rs
│   ├── piston
│   │   ├── draw.rs
│   │   ├── event.rs
│   │   └── mod.rs
│   └── winit.rs
├── border.rs
├── color.rs
├── cursor.rs
├── event.rs
├── graph
│   ├── algo.rs
│   ├── depth_order.rs
│   └── mod.rs
├── guide
│   ├── chapter_1.rs
│   ├── chapter_2.rs
│   └── mod.rs
├── image.rs
├── input
│   ├── global.rs
│   ├── mod.rs
│   ├── state.rs
│   └── widget.rs
├── label.rs
├── lib.rs
├── position
│   ├── matrix.rs
│   ├── mod.rs
│   ├── range.rs
│   └── rect.rs
├── render.rs
├── tests
│   ├── global_input.rs
│   ├── mod.rs
│   ├── ui.rs
│   └── widget_input.rs
├── text.rs
├── theme.rs
├── ui.rs
├── utils.rs
└── widget
    ├── bordered_rectangle.rs
    ├── builder.rs
    ├── button.rs
    ├── canvas.rs
    ├── collapsible_area.rs
    ├── drop_down_list.rs
    ├── envelope_editor.rs
    ├── file_navigator
    │   ├── directory_view.rs
    │   └── mod.rs
    ├── graph
    │   ├── mod.rs
    │   └── node.rs
    ├── grid.rs
    ├── id.rs
    ├── list.rs
    ├── list_select.rs
    ├── matrix.rs
    ├── mod.rs
    ├── number_dialer.rs
    ├── plot_path.rs
    ├── primitive
    │   ├── image.rs
    │   ├── line.rs
    │   ├── mod.rs
    │   ├── point_path.rs
    │   ├── shape
    │   │   ├── circle.rs
    │   │   ├── mod.rs
    │   │   ├── oval.rs
    │   │   ├── polygon.rs
    │   │   ├── rectangle.rs
    │   │   └── triangles.rs
    │   └── text.rs
    ├── range_slider.rs
    ├── rounded_rectangle.rs
    ├── scrollbar.rs
    ├── scroll.rs
    ├── slider.rs
    ├── tabs.rs
    ├── text_box.rs
    ├── text_edit.rs
    ├── title_bar.rs
    ├── toggle.rs
└── xy_pad.rs

作为参考,我Cargo.toml还包括glutin作为依赖项:

[features]
default = ["winit", "glium"]

winit = ["conrod/winit"]
glium = ["conrod/glium"]

[dependencies]
conrod = "^0.57"
find_folder = "*"
glutin = "*"
4

1 回答 1

1

conrod我认为这是对and的模块结构的误解glium

conrod crate 有许多后端模块,包含每个不同后端的实用程序功能。conrod::backend::glium是 glium 的这个模块,它包含对使用 conrod 和 glium 有用的结构和东西。

但是,在您的情况下,我认为您将这个模块误认为是glium它本身

glium是一个独立于 conrod 的 crate,你需要像依赖glutin. glium确实有一个glium::conrod属性,所以如果你确实使用extern crate glium;而不是使用conrod::backend::glium它,它应该“正常工作”!

您还需要在其中添加一些行glium = 0.xCargo.toml但这应该是微不足道的。

于 2018-01-23T07:00:06.873 回答