I'm new to Rust and I'm trying to open a window with the Conrod library, like they did in the canvas.rs
example:
#[macro_use] extern crate conrod;
extern crate find_folder;
extern crate piston_window;
use conrod::{Canvas, Theme, Widget, color};
use piston_window::{EventLoop, OpenGL, PistonWindow, UpdateEvent, WindowSettings};
fn main() {
const WIDTH: u32 = 800;
const HEIGHT: u32 = 600;
// Change this to OpenGL::V2_1 if not working.
let opengl = OpenGL::V3_2;
// Construct the window.
let mut window: PistonWindow =
WindowSettings::new("Canvas Demo", [WIDTH, HEIGHT].opengl(opengl).exit_on_esc(true).vsync(true).build().unwrap();
window.set_ups(60);
}
This code works when I use it in a a file in the Conrod project (the one I downloaded from GitHub), but it does not work when I use it in my own code:
extern crate conrod;
extern crate piston_window;
fn main() {
println!("Hello, world!");
}
With the following Cargo.toml:
[package]
name = "hello_conrod"
version = "0.1.0"
authors = ["omega"]
[dependencies]
conrod = "0.37.2"
Then the compiler tells me this:
error: can't find crate for `piston_window` [E0463]
I guess my Cargo.toml
is wrong but I don't have a clue what I should do.