开发者

link with libc-dbg and libc-prof

开发者 https://www.devze.com 2022-12-14 18:52 出处:网络
I got multiple versions of libc installed, how do I c开发者_Go百科hoose which to link with at compile time?

I got multiple versions of libc installed, how do I c开发者_Go百科hoose which to link with at compile time?

Right now i'm compiling like

g++ prog.cpp


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.


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. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号