因此,我在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窗口上运行它时,会发生这样的情况:
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发布于 2021-06-12 11:59:23
您可以通过选择所需的OpenGL版本来解决这个问题。
您可以通过按F6来实现这一点,在右下角有一个列表,选择raylib_source_compile。在第4行,选择所需的OpenGL版本(GRAPHICS_API_OPENGL_33、GRAPHICS_API_OPENGL_21和GRAPHICS_API_OPENGL_11),然后按enter键重新编译Raylib库。
如果它仍然不工作,转到C:\raylib\raylib\src\config.h,取消注释第47行,重新编译Raylib (这对我起作用)
https://stackoverflow.com/questions/67889491
复制相似问题