-Wall
– Print all compiler warnings -o
– Change the output file
When you have to include headers from other projects using #include <>
gcc will search for these header files (.h
) and shared object files (.so
). When compiling you need to tell GCC to include these files as well.
The skinny: Use -l
to include libraries in an external
-l<lib-name>
has to come after FILENAME.c
-l
and <lib-name>
libmyfunctions.so
use -lmyfunctions
The skinny: Use -L
to add a directory with an external .so
file
GCC knows where to look for external libraries. Usually developers know put these libraries where GCC can find them, e.g. /usr/lib
. However, not all libraries are stored where GCC can find them. In this case you need to add the directory with your shared object to GCC’s search path using -L
Notes on Computers
AWS · Bash · C · C++ · Cyber Security · Git · LaTeX · Linux · Networking · Python · Raspberry Pi · Tools · Vim
Notes on Math & Physics
Information Theory · Linear Algebra · Solid State Physics
Copyright 2021 · Eric D. Weise