

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- Why does the order in which libraries are linked sometimes cause errors in GCC?
- What are the symptoms of bird flu which should not be ignored?
- What should be the Python class order in a file?
- What are thread libraries?
- What are Standard Libraries in C++?
- Which equals operator (== vs ===) should be used in JavaScript?
- Which equals operator (== vs ===) should be used in JavaScript comparisons
- What are free libraries for Canvas in HTML5?
- What are some facts about forests in India which everyone should know?
- Which MySQL Datatype should be used for storing BloodType?
- Which are the apps to order medicines online?
- What are the curries in which cinnamon can be used to improve the taste?
- Explain the scenario in which CURSOR should be used over a standalone SELECT statement?
- Which Eclipse Plugin should be installed to work with Cucumber?
- Which Measurement Unit should be used in CSS to set letter spacing