简体   繁体   中英

Cannot find `glutin` in `glium` when using Conrod

I am attempting to add a GUI to a small project of mine using Conrod. I have managed to work my way down to 3 compilation errors:

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. 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 .

Furthermore, I cannot seem to find any reference to glutin in the project directory itself:

$> 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:

[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 .

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.

In your case, however, I think you mistook this module for glium itself .

glium is a separate crate from conrod, and you'll need to depend on it much like you depend on glutin . glium does indeed have a glium::conrod property, so if you do pull it in with extern crate glium; rather than using conrod::backend::glium , it should "just work"!

You'll need to add some line glium = 0.x in your Cargo.toml as well, but that should be trivial.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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