raylib-game-template icon indicating copy to clipboard operation
raylib-game-template copied to clipboard

Getting linker error with cmake

Open mrdaybird opened this issue 1 year ago • 1 comments

Getting the following linker error when building with cmake: (pruned for readability)

...
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwGetTime
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwSwapBuffers
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwSetErrorCallback
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwInit
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwDefaultWindowHints
wasm-ld: error: _deps/raylib-build/raylib/libraylib.a(rcore.c.o): undefined symbol: glfwWindowHint
...

Adding the following after line 44 fixed the issue:

    target_link_options(${PROJECT_NAME} PUBLIC "-sUSE_GLFW=3")

mrdaybird avatar Jun 19 '24 08:06 mrdaybird

@mrdaybird feel free to send a PR with the review!

raysan5 avatar Jun 19 '24 09:06 raysan5