raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.62k stars 2.27k forks source link

undefined reference to `timeEndPeriod' #4490

Closed stupidwhodoesntknowanything closed 6 hours ago

stupidwhodoesntknowanything commented 7 hours ago

I am trying to link my libraylib.a to my vs code project with mingw64 on windows11 my project is fairly easy it just calls InitWindow() and that's it. But I seem to get some unexcepted errors C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rcore.o):rcore.c:(.text+0x27be6): undefined reference to `timeEndPeriod' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rcore.o):rcore.c:(.text+0x2e7e4): undefined reference to `timeBeginPeriod' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd4d2): undefined reference to `__imp_CreateDCW' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd50a): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd528): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd588): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd5f9): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xd625): undefined reference to `__imp_DeleteDC' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xdfa5): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xdfbd): undefined reference to `__imp_GetDeviceCaps' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe5dc): undefined reference to `__imp_CreateDCW' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe5fa): undefined reference to `__imp_GetDeviceGammaRamp' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe60d): undefined reference to `__imp_DeleteDC' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe76e): undefined reference to `__imp_CreateDCW' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe78c): undefined reference to `__imp_SetDeviceGammaRamp' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xe79f): undefined reference to `__imp_DeleteDC' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xea71): undefined reference to `__imp_CreateDIBSection' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xeae2): undefined reference to `__imp_CreateBitmap' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xeb11): undefined reference to `__imp_DeleteObject' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xec19): undefined reference to `__imp_DeleteObject' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xec29): undefined reference to `__imp_DeleteObject' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xf49b): undefined reference to `__imp_CreateRectRgn' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0xf4ee): undefined reference to `__imp_DeleteObject' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x15bbf): undefined reference to `__imp_DescribePixelFormat' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x16846): undefined reference to `__imp_DescribePixelFormat' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x16c2c): undefined reference to `__imp_SwapBuffers' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x16f77): undefined reference to `__imp_ChoosePixelFormat' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x16f90): undefined reference to `__imp_SetPixelFormat' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x17348): undefined reference to `__imp_DescribePixelFormat' C:\w64devkit\bin/ld.exe: C:/w64devkit/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libraylib.a(rglfw.o):rglfw.c:(.text+0x1738e): undefined reference to `__imp_SetPixelFormat'

This is my command on cmd g++ src/main.cpp -o src/main.exe -I ${workspaceFolder}/include/raylib -L ${workspaceFolder}/lib -lraylib

I'm a beginner programmer so any help would be greatly appreciated

raysan5 commented 6 hours ago

raylib requires some Windows system libraries to be linked: https://github.com/raysan5/raylib/wiki/Working-on-Windows#a-note-on-dependencies

It requires: -lraylib -lopengl32 -lgdi32 -lwinmm