Search code examples
consolenim-lang

Removing Console window in Nim


I have written a program in Nim, which on execution opens a blank cmd

I found that using switches during compilation this can be removed, But I don't want to use any contemplation flags. Means as in C language, we use

HWND console = GetConsoleWindow();
ShowWindow(console, SW_HIDE);

to hide the window So, is there any code that I can write inside my Nim Program that will hide the gui console ?


Solution

  • In the compiler user guide, it has an 'app' flag, if you're making a GUI app, passing --app:gui should work for your app, hope this helps!

    (Slight edit as I misread the question) You can put this into a config.nims file in the same folder as the main file, to pass flags to the compiler without doing it via the command line.

    https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches