   How does this part of GCC work?
  When linking libraries by GCC, I can use parameters (e.g. -lSDL).I could also use library name.But if I had not SDL installed, I would not have -lSDL available.How does this part of GCC work?   
  When GCC parses your command options and finds one that goes -llibrary it searches for 'liblibrary.a' (and apparently liblibrary.so according to at least one person on the internet). That is to say these two are equivalent to GCC:-lSDL-l libSDL.aApparently the second example is frowned upon.   ;  Another thing that's going on: Unixy systems have standard locations for library paths. By default, it looks for library files in /usr/lib and in /usr/local/lib. If SDL is installed there, then you don't need to specify a library path.   ;  type "man gcc"Everything you ever wanted to know about gcc and way....way more, or go here for a web versionhttp://linux.die.net/man/1/gcc   ;Quote:Original post by nobodynewsWhen GCC parses your command options and finds one that goes -llibrary it searches for 'liblibrary.a' (and apparently liblibrary.so according to at least one person on the internet)This will search for a libspoo.so and link it dynamically:gcc -lspoo main.c -o mainwhile this will search for a libspoo.a and link it staticallygcc -static -lspoo main.c -o mainand this will search for libspoo.a and libfoo.so and link them statically and dynamically, respectively:gcc -static -lspoo -dynamic -lfoo main.c -o mainQuote:Original post by nobodynews-l libSDL.aApparently the second example is frowned upon.That's because the actual file can have a different name, e.g. -lSDL would actually link in a file called libSDL.so.1.2.13. You generally wanna leave the filename resolving to the linker, that's its job. The only exception is when you really know that that's the file you want to link in and you think the linker might screw it up, a file from your own project for example.   ;  You must specify library paths with -L.-lSDL works because -L/usr/lib is there by default and there is a file /usr/lib/libSDL.a.   