xiggies
xiggies

Reputation: 61

Haxe program to hide console

I am trying to hide the console when running the Haxe application.

I am using FlashDevelop to compile Haxe into hxcpp, and this is my project.xml

<?xml version="1.0" encoding="utf-8"?>
<project>

    <!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
    <meta title="haxeGame" package="haxeGame" version="1.0.0" company="xiggie" />

    <!-- output -->
    <app main="Main" file="haxeGame" path="bin" />

    <window width="800" height="480" fps="60" background="0x000000" orientation="landscape" resizable="false" borderless="true" />
    <window vsync="true" antialiasing="6" />

    <!-- classpath, haxe libs -->
    <classpath name="src" />
    <haxelib name="openfl" />
    <haxelib name="actuate" />

    <!-- assets -->
    <icon path="assets/texture.jpg" />
    <assets path="assets" rename="assets" />

    <!-- optimize output
    <haxeflag name="-dce full" /> -->

    <!-- Windows app: hide console -->
    <setenv name="no_console" value="1" />
    <flag value="subsystem:windows" />

</project>

I have tried all of these:

<haxeflag name="-D no_console" />
<haxedef name="no_console" />
<setenv name="no_console" value="1" />

Is it actually possible to remove the console from the release app?

Upvotes: 2

Views: 874

Answers (1)

Seb T
Seb T

Reputation: 912

The console should be hidden by default. To make it appear one needs to add

<setenv name="SHOW_CONSOLE" />

However, when using mingw instead of msvc as compiler, the toolchain configuration that comes with hxcpp currently does not pass the flag to the linker that avoids the creation of a console window.

To work around this, search for the mingw-toolchain.xml in your haxe installation and add the -mwindows flag to the linker configuration.

I created a pull request for this https://github.com/HaxeFoundation/hxcpp/pull/286

Upvotes: 1

Related Questions