tags:

views:

149

answers:

2

I got multiple versions of libc installed, how do I choose which to link with at compile time?

Right now i'm compiling like

g++ prog.cpp
+1  A: 

Your program will link with libc. When you run in gdb, libc-dbg will be used to read symbol names, be able to generate backtraces with more informantion, etc. And if you add the -pg option when linking, libc-prof will be used and you will be able to use gprof with your program.

Gonzalo
A: 

Set environment variable LD_LIBRARY_PATH to path of your libc using following command.

export LD_LIBRARY_PATH=<path-to-libc>

To check whether program is linked to expected library use

ldd a.out

This will show you the list of libraries which the program is linked to. :)

atv