- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What should be the order in which libraries are linked in GCC?
The linker searches from left to right. While doing so it encounters unresolved symbols which it keeps track of. If a library resolves the unresolved symbol, it takes the object files of that library to resolve the symbol.
Dependencies of static libraries from each other work in the same way. Libraries requiring symbols from other library come before libraries resolving the symbol. If you have cyclic dependencies, you must enclose the libraries having a cyclic dependency in parenthesis. For example, if you have libraries a and b that are cyclically dependent −
$ g++ hello.cpp -L. -( -la -lb -)
Newer linkers are smarter and can keep track of the functions used by preceding static libraries, permanently tossing out those functions that are not used from its lookup tables. So if you link a static library very early, the methods from that library are no longer available to static libraries later on the link line.
- Related Articles
- Why does the order in which libraries are linked sometimes cause errors in GCC?
- What are Standard Libraries in C++?
- What are the symptoms of bird flu which should not be ignored?
- What are thread libraries?
- In which order should the four different digits be arranged to obtain the largest 4 digit number
- What are free libraries for Canvas in HTML5?
- What are top JavaScript animation libraries?
- What are some Underrated Python Libraries?
- What are some of the important Scientific Libraries used in Lua programming?
- What are the Python libraries that are used by data scientists?
- Which equals operator (== vs ===) should be used in JavaScript?
- What are the exams to be written in order to get a job in Canada?
- What are some facts about forests in India which everyone should know?
- Which equals operator (== vs ===) should be used in JavaScript comparisons
- Python - Find indices where elements should be inserted to maintain order in Pandas Index
