How to hide a console in makefile

509 Views Asked by At

I am making something in Raylib C++ and every time I open the .exe file, the console and the raylib window opens up. How can stop/hide the console from opening up.

This is the makefile currently.

default:
    g++ ../Test.cpp -o Test -O2 -Wall -Wno-missing-braces -I ..\include/ -L ..\lib/ -lraylib -lopengl32 -lgdi32 -lwinmm

My C++ file

//@ Makefile: mingw32-make
//@ Exe: ./build/Test.exe
#include "include/raylib.h"
#include "include/raymath.h"
#include "include/physac.h"

int main() {
    int screenWidth = 1000;
    int screenHeight = 1000;

    InitWindow(screenWidth, screenHeight, "Ball");
    // void SetWindowIcon(Image "");
    Vector2 ballPosition = {(float)screenWidth/2, (float)screenHeight/2};
    SetTargetFPS(60);

    while (!WindowShouldClose()) {
        if (IsKeyDown(KEY_D)) ballPosition.x += 5.0f;
        if (IsKeyDown(KEY_A)) ballPosition.x -= 5.0f;
        if (IsKeyDown(KEY_W)) ballPosition.y -= 5.0f;
        if (IsKeyDown(KEY_S)) ballPosition.y += 5.0f;

        BeginDrawing();
            ClearBackground(Color {255, 255, 255, 255});
            DrawText("move the ball with wasd keys", 10, 10, 50, DARKGRAY);
            DrawCircleV(ballPosition, 50, MAROON);
        EndDrawing();
    }
    CloseWindow();
    return 0;
}

1

There are 1 best solutions below

2
On

Add -mwindows to the linker flags.