Rust+slint developed desktop application, black cmd window how to cancel

slint versions 1.6.0

main.rs

slint::slint! {
    export component MainWindow inherits Window {
        width: 300px;
        height: 300px;
        title: "my-win";
        Text {
            text: "hello world";
            color: green;
            font-size: 16px;
        }
    }
}

fn main() {
    MainWindow::new().unwrap().run().unwrap();
}

cargo build -r Pack out the exe file, double-click to run will open the window, but at the same time will open a black cmd window, how to make this black window disappear

Add #![windows_subsystem = "windows"] to your main.rs. If you want the window to still appear in debug builds, use #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] instead.

2 Likes

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.