如何将控制台隐藏在makefile中

发布于 2025-01-23 13:38:09 字数 1257 浏览 3 评论 0原文

我在Raylib C ++中做点什么,每次打开.exe文件时,控制台和Raylib窗口都会打开。如何停止/隐藏控制台打开。

这是当前的makefile。

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

我的C ++文件

//@ 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;
}

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;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海里的那抹蓝 2025-01-30 13:38:11

-mwindows添加到链接标志。

Add -mwindows to the linker flags.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文