-1

I am adding the raylib library in code blocks but I don't know what is going on, because I get this error:

-------------- Build: Debug in teste (compiler: GNU GCC Compiler)---------------

gcc.exe -LC:\Users\tiago\Documents\raylib -o bin\Debug\teste.exe obj\Debug\main.o   C:\Users\tiago\Documents\raylib\libraylib.a
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rcore.o):rcore.c:(.text+0x16ba2): undefined reference to `timeEndPeriod@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rcore.o):rcore.c:(.text+0x1c8cb): undefined reference to `timeBeginPeriod@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x18e3): undefined reference to `_imp__CreateRectRgn@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x1927): undefined reference to `_imp__DeleteObject@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x198c): undefined reference to `_imp__SwapBuffers@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x245d): undefined reference to `_imp__GetDeviceCaps@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x2b3a): undefined reference to `_imp__CreateDCW@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x2b50): undefined reference to `_imp__GetDeviceGammaRamp@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x2b5c): undefined reference to `_imp__DeleteDC@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x65b6): undefined reference to `_imp__CreateDCW@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x65ef): undefined reference to `_imp__GetDeviceCaps@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x661d): undefined reference to `_imp__DeleteDC@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x67ba): undefined reference to `_imp__GetDeviceCaps@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x6a5f): undefined reference to `_imp__CreateDIBSection@24'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x6aaa): undefined reference to `_imp__CreateBitmap@20'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x6b44): undefined reference to `_imp__DeleteObject@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x6b97): undefined reference to `_imp__DeleteObject@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x8574): undefined reference to `_imp__CreateDCW@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x8586): undefined reference to `_imp__SetDeviceGammaRamp@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0x8592): undefined reference to `_imp__DeleteDC@4'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xe947): undefined reference to `_imp__ChoosePixelFormat@8'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xe95b): undefined reference to `_imp__SetPixelFormat@12'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xedf2): undefined reference to `_imp__DescribePixelFormat@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xeee5): undefined reference to `_imp__DescribePixelFormat@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xf2ff): undefined reference to `_imp__DescribePixelFormat@16'
C:\MinGW\bin/ld.exe: C:\Users\tiago\Documents\raylib\libraylib.a(rglfw.o):rglfw.c:(.text+0xf32a): undefined reference to `_imp__SetPixelFormat@12'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
27 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Gerhardh
  • 11,688
  • 4
  • 17
  • 39
  • You don't indicate which OS you are on (Windows, Linux, Mac), but did you follow the notes at the raylib link for your operating system [Raylib OS](https://github.com/raysan5/raylib) along with the notes regarding setup of CodeBlocks [Raylib CodeBlocks](https://github.com/raysan5/raylib/tree/master/projects/CodeBlocks)? – NoDakker Sep 04 '22 at 15:09
  • The functions it does not find are Windows functions. Try adding the link options -lgdi32 -luser32 -lkernel32 – CGi03 Sep 04 '22 at 16:25
  • Thank you for your help. I added those libraries and it still doesn't work. Do you have any idea what might be going on? By coincidence, nobody adds the library to the code blocks. Raylib provides a compiler with the library installed to be used in code blocks. But I don't want to be constantly changing compilers. – Albino Almeida Sep 06 '22 at 20:41

1 Answers1

-1

Basically the problem is with the code blocks themselves. Using the compiler by hand on the command line everything works perfectly. I have given up on code blocks, because the command it generates is defective.