www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Hide console on Windows with app running SDL2

reply bauss <jacobbauss gmail.com> writes:
Running into a couple of problems trying to hide the console that 
opens when running an app that uses sdl2.

First of all I am trying to compile with this using dub:

```
"lflags": ["/SUBSYSTEM:windows"]
```

However that gives me the following error:

```
error LNK2019: unresolved external symbol WinMain
```

And then if I add a WinMain like below:

```
extern (Windows) int WinMain() { return 0; }
```

Then of course it doesn't work, but what is the obvious way to 
solve this?

I basically just want to hide the console, but nothing seems to 
work straight out of the box.
May 28
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On Tuesday, 28 May 2024 at 12:35:42 UTC, bauss wrote:
 Running into a couple of problems trying to hide the console 
 that opens when running an app that uses sdl2.

 First of all I am trying to compile with this using dub:

 ```
 "lflags": ["/SUBSYSTEM:windows"]
 ```

 However that gives me the following error:

 ```
 error LNK2019: unresolved external symbol WinMain
 ```

 And then if I add a WinMain like below:

 ```
 extern (Windows) int WinMain() { return 0; }
 ```

 Then of course it doesn't work, but what is the obvious way to 
 solve this?

 I basically just want to hide the console, but nothing seems to 
 work straight out of the box.
I think this is still relevant: https://wiki.dlang.org/D_for_Win32 -Steve
May 28
parent bauss <jacobbauss gmail.com> writes:
On Tuesday, 28 May 2024 at 12:45:39 UTC, Steven Schveighoffer 
wrote:
 On Tuesday, 28 May 2024 at 12:35:42 UTC, bauss wrote:
 Running into a couple of problems trying to hide the console 
 that opens when running an app that uses sdl2.

 First of all I am trying to compile with this using dub:

 ```
 "lflags": ["/SUBSYSTEM:windows"]
 ```

 However that gives me the following error:

 ```
 error LNK2019: unresolved external symbol WinMain
 ```

 And then if I add a WinMain like below:

 ```
 extern (Windows) int WinMain() { return 0; }
 ```

 Then of course it doesn't work, but what is the obvious way to 
 solve this?

 I basically just want to hide the console, but nothing seems 
 to work straight out of the box.
I think this is still relevant: https://wiki.dlang.org/D_for_Win32 -Steve
Thanks a lot, that helped and solved the issue
May 28