1. Notes
In the compilation process, add-L in front of the static library as usual, but the final compilation fails, prompting that the file cannot be found. Later, after being instructed by someone else, instruct-L to remove the file, compiled.
I have added the related path to the lD. So. conf file and executed ldconfig.
The following is taken from [1].
2. Static Library Reference
The-L option tells the compiler where to find the required library file.-L indicates to find it in the current directory. -Lstack tells the compiler to connect to the libstack library, and the-I option tells the compiler where to find the header file. Note: even if the library file is in the current directory, the compiler will not find it by default, so the-L. Option cannot be fewer. The directory that the compiler will find by default can be viewed using the-print-search-dirs option.
3. $ ar Rs libstack. A stack. O push. O pop. O is_empty.o
AR: Creating libstack.
The library file names start with Lib, and the static library uses. A as the suffix, indicating archive. The ar command is similar to the tar command and serves as a package. However, you can only use the AR command instead of the tar command to package the target file into a static library. Option R: Add the following file list to the package. If the package does not exist, create it. If the package already contains a file with the same name, replace it with the new one. S is used to generate a static database, which indicates creating an index for the static database. This index is used by the linker. The ranlib command can also create an index for a static library. The preceding command is equivalent:
$ Ar R libstack. A stack. O push. O pop. O is_empty.o
$ Ranlib libstack.
Reference
[1] Description
Http://www.cnblogs.com/steven_oyj/archive/2010/06/24/1764253.html