I had a linker error today and this is how I fixed it.

brayden
2025-12-18 11:11:30 -05:00
parent cea07d1d3c
commit eaad9cb1b9

@ -24,6 +24,12 @@ To generate build files in separate directory and build the project, use these c
cmake -B build && cmake --build build
```
If you encounter a linker error with undefined symbols to glfw functions, it may be necessary to add `glfw` to the linking:
```cmake
target_link_libraries(${PROJECT_NAME} glfw raylib)
```
Note that this required an installation of `glfw` in the environment (e.g. through a package manager or CMake).
## Loading raylib inside cmake
If you want someone who builds your project to be able to download and build raylib with it, the [CMakeLists.txt at projects/CMake](https://github.com/raysan5/raylib/blob/master/projects/CMake/CMakeLists.txt)
will help you.