(Raylib) 无法在 Notepad++ 中执行程序。退出代码-1073741819

(Raylib) Cannot execute program in Notepad++. Exit code -1073741819

所以我 运行在 Notepad++ 中编写了一个 C 代码,但它退出时代码为:-1073741819。我不知道这是什么意思,我在网上找不到任何解释。请告诉我如何解决这个问题。

这是完整的控制台日志:

> Setup required Environment
-------------------------------------
SET: RAYLIB_PATH=C:\raylib\raylib
$(RAYLIB_PATH) = C:\raylib\raylib
SET: COMPILER_PATH=C:\raylib\mingw\bin
$(COMPILER_PATH) = C:\raylib\mingw\bin
ENV_SET: PATH=C:\raylib\mingw\bin
$(SYS.PATH) = C:\raylib\mingw\bin
SET: CC=gcc
$(CC) = gcc
SET: CFLAGS=$(RAYLIB_PATH)\src\raylib.rc.data -s -static -Os -std=c99 -Wall -I$(RAYLIB_PATH)\src -Iexternal -DPLATFORM_DESKTOP
$(CFLAGS) = C:\raylib\raylib\src\raylib.rc.data -s -static -Os -std=c99 -Wall -IC:\raylib\raylib\src -Iexternal -DPLATFORM_DESKTOP
SET: LDFLAGS=-lraylib -lopengl32 -lgdi32 -lwinmm
$(LDFLAGS) = -lraylib -lopengl32 -lgdi32 -lwinmm
CD: C:\raylib\raylib\examples\core
Current directory: C:\raylib\raylib\examples\core

> Clean latest build
------------------------
cmd /c IF EXIST core_basic_window.exe del /F core_basic_window.exe
Process started (PID=3288) >>>
<<< Process finished (PID=3288). (Exit code 0)

> Saving Current File
-------------------------
NPP_SAVE: C:\raylib\raylib\examples\core\core_basic_window.c

> Compile program
-----------------------
gcc -o core_basic_window.exe core_basic_window.c C:\raylib\raylib\src\raylib.rc.data -s -static -Os -std=c99 -Wall -IC:\raylib\raylib\src -Iexternal -DPLATFORM_DESKTOP -lraylib -lopengl32 -lgdi32 -lwinmm
Process started (PID=1924) >>>
<<< Process finished (PID=1924). (Exit code 0)

> Reset Environment
--------------------------
ENV_UNSET: PATH
$(SYS.PATH) has been restored

> Execute program
-----------------------
cmd /c IF EXIST core_basic_window.exe core_basic_window.exe
Process started (PID=3748) >>>
<<< Process finished (PID=3748). (Exit code -1073741819)
================ READY ================

这里是代码,因为很多人问(我看了一个教程来设置库,他们 运行 完全相同的代码,但它没有用。):

#include "raylib.h"

int main(void)
{
    // Initialization
    //--------------------------------------------------------------------------------------
    const int screenWidth = 800;
    const int screenHeight = 450;

    InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");

    SetTargetFPS(60);               // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        // Update
        //----------------------------------------------------------------------------------
        // TODO: Update your variables here
        //----------------------------------------------------------------------------------

        // Draw
        //----------------------------------------------------------------------------------
        BeginDrawing();

        ClearBackground(RAYWHITE);

        DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

        EndDrawing();
        //----------------------------------------------------------------------------------
    }

    // De-Initialization
    //--------------------------------------------------------------------------------------
    CloseWindow();        // Close window and OpenGL context
    //--------------------------------------------------------------------------------------

    return 0;
}

这是我在 Explorer 和 CMD 运行 上 运行 时发生的情况 window:

INFO: Initializing raylib 3.7
WARNING: GLFW: Error: 65543 Description: WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable
WARNING: GLFW: Failed to initialize Window
INFO: TIMER: Target time per frame: 16.667 milliseconds

您可以通过选择所需的 OpenGL 版本来解决此问题

按F6即可,右下角有一个列表,选择raylib_source_compile。在第 4 行,选择所需的 OpenGL 版本(GRAPHICS_API_OPENGL_33、GRAPHICS_API_OPENGL_21 和 GRAPHICS_API_OPENGL_11),然后按回车键重新编译 Raylib 库。

如果还是不行,转到C:\raylib\raylib\src\config.h,取消第47行的注释并重新编译Raylib(对我有用)