0

So I know that the python language has .py and .pyw extensions,the difference being .pyw run silent and there is no pop up, is there something like this in C++? If not, is there something I can put my code to run it silently? Of an alternative way to launch it?

Abhineet
  • 5,320
  • 1
  • 25
  • 43
Brooks
  • 359
  • 3
  • 9
  • It's a linker option (the subsystem). At least it is in Windows. I don't know how portable that is. – chris Nov 07 '13 at 03:49
  • Just out of curiousity: Does this mean, that when on windows you give a file a different name, it behaves differently? Or are these "silent" files created differently and it is just a naming convention? (genuine question) – Hyperboreus Nov 07 '13 at 04:16
  • @Hyperboreus: Normally Python scripts on Windows are run by the `python.exe` interpreter, which *always* opens a Windows console if not currently running on one so that e.g. `print` works properly. Giving a Python script a .pyw extension runs it with the `pythonw.exe` interpreter, which does *not* open a console. – Ignacio Vazquez-Abrams Nov 07 '13 at 04:25

1 Answers1

1

There isn't one. On Windows, simply implement WinMain() as your entry point instead of main(), and change your linker options to create a GUI app instead of a console app. On *nix no change is required.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358