O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Linking Programs with the ld Linker

The ld linker links object files (the intermediate files that gcc generates) to system library files to produce executable files. Because most programs that Linux runs are usually based on shared code, incompatibilities sometimes occur when moving programs between different releases or distributions of Linux.

The ld linker knows about the standard libraries on your system and attempts to link these with the object files of the program. For example, if you have an object file called greeting.o that you have compiled with gcc, you would use the following command to produce an executable file with the same name:

ld -o greeting greeting.o

The ld linker would take the standard library files and dynamically link ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required