My project is going to need a GUI interface, so I've been searching for a crate to help me with that. I found the fltk
crate that looks like it might do the trick. On Github they even have examples that may help kickstart my efforts. However, I can't seem to get the crate to work for me. I used cargo new
to create a new project, copied the first example from the first page of the fltk book, modified my cargo.toml
file with fltk = "^1.4"
, and then tried to compile. All kinds of errors and after a lot of experimentation, I find myself confused as to why it won't work. So, help??
Here's the code for my main.rs
:
use fltk::{prelude::*, window::Window};
fn main() {
let wind = window::Window::new(100, 100, 400, 300, "My Window");
wind.end();
wind.show();
}
This is just copied from the fltk book
so there shouldn't be any typos. The cargo.toml
file looks like this:
[package]
name = "deleteme"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
fltk = "^1.4"
Here's what the compiler says:
error[E0433]: failed to resolve: use of undeclared crate or module `window`
--> src/main.rs:4:24
|
4 | let wind = window::Window::new(100, 100, 400, 300, "My Window");
| ^^^^^^ not found in `window`
|
help: consider importing this type alias
|
1 | use fltk::window::Window;
|
help: if you import `Window`, refer to it directly
|
4 - let wind = window::Window::new(100, 100, 400, 300, "My Window");
4 + let wind = Window::new(100, 100, 400, 300, "My Window");
So, any suggestions as to how to get this working?
Thanks.