Question about the linker

hi everyone,

i'm currently using codeblocks as IDE, what i'd like to know is how does the linker know the filename of a library ?

example: glfw3
if i want a glfw3 project, i copy the "include/GLFW" folder with all the headder files into my "include" folder (which is automatically created by codeblocks when creating a new class), and set an additional "compiler" directory to "include".
the next thing is i create a "lib" folder, and copy the file "libglfw3.a" into that folder, and add a "glfw3" (besides "gdi32" and "opengl32") to the "link libraries".

my question is how does te linker know that "glfw3" actually means "libglfw3.a" ? is it always like XYZ = "libXYZ.a" ?

thanks for your replies!
man wrote:
-llibrary
Search the library named library when linking.

The linker searches a standard list of directories for the library, which is
actually a file named liblibrary.a. The linker then uses this file as if it
had been specified precisely by name.

The directories searched include several standard system directories plus any
that you specify with -L.

The only difference between using an -l option and specifying a file name is
that -l surrounds library with lib and .a and searches several directories.
*.a refers to static libraries, the same may be said about *.so (dynamic libraries)



Libraries may depend on other libraries, so figuring out all the files that we need to link against may be too much work. You could use the `pkg-config' program to retrieve that information
g++ foo.o $(pkg-config --libs sfml-all)

Topic archived. No new replies allowed.