Michael Barr pointed out the correct way to link libraries on the command line. The path to the library is set using the -L switch and the library name using the -L switch (library name is the file name, without the lib part at the beginning) and .a at the end).
Another thing worth paying attention to is that you are trying to establish a link to both the static (libglfw.a) and dynamic (glfw.dll) versions of the library that are included in the download at the same time. Instead, you should choose one based on your needs / desires, and only a link to it.
The link to the static version is simple. Just add -lglfw to the command line.
To use the dynamic library, you must reference the import library for dll ( libglfwdll.a ) using the -lglfwdll switch and omit the dll itself from the link command. In principle, the import library does not contain any object code, but only a definition; the actual code is in the dll. The DLL will dynamically bind at runtime. (For this, the system must be able to find the dll, that is, it must be in the current working directory, in the directory that is in the path, or its directory must be added to the special environment variable used for this, but in order for it to become important, you need to create an executable file first.)
source share