Disable the console

After launching the program, the console appears. How do I block the console from appearing? I use the slint framework in the program. This code does not work (#![windows_subsystem = "windows"]).

Are you sure it is the first line (after other top-level crate attributes and empty lines) in your crate root file of your binary, i.e. src/main.rs, for example?

if the compiler didn't complain about this attribute, it should work. how did you run the program? can you confirm it's the console of your program, not cargo?

The structure of the main.rss
slint file is::include_modules!();
#[windows_subsystem = "windows"]

fn main(){

}

- there is no error

#! - - gives an error

That is not valid usage of a top-level crate attribute. They must be in the crate root and must be defined as inner attribute before anything else, like type definitions or import statements:

#![windows_subsystem = "windows"]

use slint::*; 

fn main() {
    // ...
}
1 Like

I did as you said. Everything is working! Thank you for your help!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.