Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run window without console prompt being still open #649

Closed
Syrou opened this issue Oct 31, 2015 · 7 comments
Closed

Run window without console prompt being still open #649

Syrou opened this issue Oct 31, 2015 · 7 comments

Comments

@Syrou
Copy link

Syrou commented Oct 31, 2015

Not an issue per se, but, once you have a glutin window up and use glium to draw something in it, i'd like to only show that window, not the console too. Is this possible to remove the console prompt somehow, while having the glutin window still running?

@ghost
Copy link

ghost commented Oct 31, 2015

This is kind of a logistics thing with how processes work in general. If you run Google Chrome from a terminal, and close the terminal, Chrome will close with it. What OS are you on? On Linux you can run your program like so and safely close the terminal:

nohup target/debug/program_name &

The above assumes the following:

  • You're in the same directory as Cargo.toml
  • You're doing a debug build (default when you do cargo build)
  • Your crate is named program_name (not likely)

@Syrou
Copy link
Author

Syrou commented Oct 31, 2015

I'm on Windows. It seems weird to me this is something you should not be able to specify when you build. But then again my first day using rust and dabbling with opengl

@tomaka
Copy link
Contributor

tomaka commented Oct 31, 2015

You must tell Windows whether or not it should open a console with a flag in the executable's headers. Therefore this is done by passing an option to the linker.

In practice, for the moment I think you can make it work by creating a small .bat script that calls gcc and passes the -mwindows flag. That's for the MinGW version of Rust. For the MSVC version of Rust the flag is different.

cc @retep998 who may have a example

@Syrou
Copy link
Author

Syrou commented Oct 31, 2015

Found this: http://stackoverflow.com/questions/29763647/how-to-make-a-program-that-does-not-display-the-console-window/29764309#29764309 meanwhile. Seems like there has been an active discussion in this thread: rust-lang/cargo#544

on the subject too

@retep998
Copy link
Contributor

cargo rustc -- -Clink-args="/SUBSYSTEM:WINDOWS" along with providing the equivalent entry point since Rust only handles the console entry point.

@Revertron
Copy link

@Syrou I've just added a full answer how to build a windows app without console window in that SO question.

@tomaka
Copy link
Contributor

tomaka commented Nov 3, 2016

An RFC for this has recently been accepted: rust-lang/rfcs#1665
Here is the tracking issue that you should follow to know when it's implemented: rust-lang/rust#37499

@tomaka tomaka closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants