0

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 = "*"
Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
jmcph4
  • 197
  • 2
  • 8
  • Welcome to Stack Overflow! Please review how to create a [MCVE]. Specifically, you should be able to provide a **small** piece of code that reproduces the same error. I would guess it would only need to be one file about 5 lines long. Hint: make it so this has the same error `fn x(_: glium::glutin::EventsLoop) {}` – Shepmaster Jan 21 '18 at 14:58
  • It's super hard to tell exactly where your error is given that you don't include your `use` and `extern crate` statements, but my best guess is that you aren't depending on `glium`, or the "glium" module you're trying to use isn't actually `glium`? There's a `conrod::backend::glium` module which _is not the same as `glium`_. Since you aren't depending on `glium = 0.19` in your Cargo.toml, I assume you're trying to use conrod's glium module rather than glium itself? The _actual_ `glium` crate does have a `glutin` property. – daboross Jan 21 '18 at 18:26
  • @daboross your comment solved the problem. Basically I was trying to use `conrod::backend::glium` insterad of `glium::glutin`. I attribute this to myself but also the misleading Conrod example code (personally I think their documentation is lacking). I'd like to mark this as answered, care to post it as such? – jmcph4 Jan 23 '18 at 06:55
  • I'll do that - glad it works! – daboross Jan 23 '18 at 06:56

1 Answers1

1

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.

daboross
  • 716
  • 10
  • 23