From eaad9cb1b9899c88a7f5b29756af5ea46778728e Mon Sep 17 00:00:00 2001 From: brayden Date: Thu, 18 Dec 2025 11:11:30 -0500 Subject: [PATCH] I had a linker error today and this is how I fixed it. --- Working-with-CMake.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Working-with-CMake.md b/Working-with-CMake.md index 0d51bfe..7338216 100644 --- a/Working-with-CMake.md +++ b/Working-with-CMake.md @@ -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.