raysan5 / raylib-game-template

A small template to start your raylib game
zlib License
389 stars 92 forks source link

Getting linker error with cmake #31

Open mrdaybird opened 3 months ago

mrdaybird commented 3 months ago

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")
raysan5 commented 3 months ago

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