简体   繁体   English

使用Conrod时,无法在“ glium”中找到“ glutin”

[英]Cannot find `glutin` in `glium` when using Conrod

I am attempting to add a GUI to a small project of mine using Conrod. 我正在尝试使用Conrod将GUI添加到我的一个小项目中 I have managed to work my way down to 3 compilation errors: 我设法解决了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`

I've studied the examples that ship with Conrod (particularly the text_edit.rs example) and have successfully compiled and run them. 我研究了Conrod附带的示例(尤其是text_edit.rs示例),并成功编译并运行了它们。 As far as I can tell, they use the same techniques (as my code is directly inspired by their examples), yet does not suffer from the unresolved imports of glutin . 据我所知,它们使用相同的技术(因为我的代码直接受其示例启发),但并未受到尚未解决的glutin进口的困扰。

Furthermore, I cannot seem to find any reference to glutin in the project directory itself: 此外,我似乎在项目目录本身中找不到任何对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

For reference, my Cargo.toml also includes glutin as a dependency: 作为参考,我Cargo.toml还包括glutin作为一个依赖:

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

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

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

I believe this is a misconception about the module structure of conrod and glium . 我相信这是一个关于模块结构的误解conrodglium

The conrod crate has a number of backend modules, containing utility functions for each of the different backends. 水泥包装箱具有许多后端模块,其中包含每个不同后端的实用程序功能。 conrod::backend::glium is this module for glium, and it contains structures and things useful for using conrod with glium. conrod::backend::gliumconrod::backend::glium的这个模块,它包含对conrod和glium有用的结构和事物。

In your case, however, I think you mistook this module for glium itself . 但是,就您的情况而言,我认为您将这个模块误认为是glium本身

glium is a separate crate from conrod, and you'll need to depend on it much like you depend on glutin . glium是由连杆独立的箱子,和你需要依赖于它就像你依靠glutin glium does indeed have a glium::conrod property, so if you do pull it in with extern crate glium; glium确实具有glium::conrod属性,因此,如果使用extern crate glium;将其拉extern crate glium; rather than using conrod::backend::glium , it should "just work"! 而不是使用conrod::backend::glium ,它应该“正常工作”!

You'll need to add some line glium = 0.x in your Cargo.toml as well, but that should be trivial. 你需要添加一些行glium = 0.xCargo.toml为好,但应该是微不足道的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM