I'm using GLFW for creating a gl context in C++. Would anybody know why when using GCC and mingw-w64, I'm unable to statically link to their lib, and instead I must link dynamically?
I'll add a link below with the solution that worked for me, but unfortunately the poster has no idea why the solution works, but I do want to know.
Read icdae's answer. Again, my program compiles perfectly, but I'd like to learn what's why static linking doesn't work.
Oh and this is how I compile my program just in case, ignore Vulkan.
g++ src/main.cpp src/renderer.cpp src/debug.cpp src/time.cpp -I include -I include -L lib -lglfw3dll -lvulkan-1 -o Game
More Detail:
Also, I downloaded the proper zip from the GLFW site that includes a folder named "lib-mingw-w64", which has: glfw3.dll, libglfw3.a, libglfw3dll.a and is what I'm using right now.
@LB actually you can ignore the answer above, I did a little more research on the difference between static and dynamic linking and I believe I understand what you mean now. If I statically link, I must include any required dependencies, in my case opengl32.
I read a lot of people suggesting dynamic linking more since less code is copied.
There are advantages and disadvantages to both dynamic and static linking - it really depends on your use case. For a game, it doesn't really matter so much, so just do whatever's easier for now.