Two ways to build a windows GUI executable file without console window

##First:
add these lines at the begin of your sorce file:

#![feature(link_args)]
#[link_args = "-Wl,--subsystem,windows"]
extern "C" {}

##Second:
->run cmd.exe
->cd into your project dir
->mkdir .cargo
then create a config file with these:

[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-args=-mwindows "]
1 Like

Windows Subsystem feature is expected to be included in Rust 1.18, so this will become easier.

4 Likes

note that link-args=-mwindows works only on gnu and -Wl,--subsystem,windows only works on msvc.

2 Likes

I'm pretty sure neither of those work in msvc. What does work in msvc is /SUBSYSTEM:WINDOWS, although you really should be using the new windows subsystem crate attribute.