yeemmeehg
yeemmeehg

Reputation: 11

vscode won't let me execute raylib

gcc core_basic_window.c -o game.exe -o1 -Wall -std=c99 -Wno-missing-braces -I include/ -L Iraylib -Iopeng132 -Igdi32 -Iwinmm
D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0x37): undefined reference to InitWindow' D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0x43): undefined reference to SetTargetFPS'
D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0x4a): undefined reference to BeginDrawing' D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0x72): undefined reference to ClearBackground'
JZC.o:core_basic_window.c:(.text+0xc4): undefined reference to EndDrawing' D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0xc9): undefined reference to WindowShouldClose'
D:\w64devkit\bin/ld.exe: C:\Users\dy.kim\AppData\Local\Temp\cc8gmJZC.o:core_basic_window.c:(.text+0xd9): undefined reference to `CloseWindow'
collect2.exe: error: ld returned 1 exit status

it won't work... I am using vscode and putted all task. vscode will say that it isn't defined.

Upvotes: 1

Views: 1070

Answers (1)

QWERTYL
QWERTYL

Reputation: 1383

Your command:

gcc core_basic_window.c -o game.exe -o1 -Wall -std=c99 -Wno-missing-braces -I include/ -L Iraylib -Iopeng132 -Igdi32 -Iwinmm

Contains a lot of typos, and contains -Is where -ls are required. The following compiles for me:

g++ main.cpp -I"Path_to_Raylib" -L"Path_to_Raylib" -lraylib -lopengl32 -lgdi32 -lwinmm

Given my system's file structure, I would write the following:

g++ main.cpp -I"C:\raylib\raylib-4.0.0_win64_mingw-w64\include" -L"C:\raylib\raylib-4.0.0_win64_mingw-w64\lib" -lraylib -lopengl32 -lgdi32 -lwinmm

If you want to use C, you would obviously change g++ to gcc and you would add things like -o if you want a specific name for your output file.

I hope this was helpful.

Upvotes: 1

Related Questions