Conflicts with value


#1

Hello. I installed Rust GTK and wanted to make a simple application with it, but I got an error. I copied the example of official repository on github.

main.rs

extern crate gtk;

use gtk::*;

fn main() {
    let x = gtk::Button::new();
}

Output:

Compiling Test v0.1.0 (file:///home/drfels/Desktop/Test)
main.rs:3:5: 3:12 error: import `main` conflicts with value in this module [E0255]
main.rs:3 use gtk::*;
              ^~~~~~~
main.rs:3:5: 3:12 help: run `rustc --explain E0255` to see a detailed explanation
main.rs:5:1: 7:2 note: conflicting value here
main.rs:5 fn main() {
main.rs:6     let x = gtk::Button::new();
main.rs:7 }
error: aborting due to previous error
Could not compile `Test`.

Also: Where i find Rust GTK Documentation and more examples?


#2

Sorry about your experience. That readme should really be cleaned up a bit. The GTK bindings are still under construction, there regularly happen breaking changes and some bits of documentation get out of date.

You can find the basic official example and slightly outdated API docs on the project website and more examples in the examples repo. For now you might be better served by the official GTK docs.

In particular, it’s no longer recommended to do a blanket import (use gtk::*), just import the traits with

use gtk::traits::*;