Cannot find -lc and -lm in g++ linux
I am using Ubuntu and gcc and g++ were working fine but today it showed:
cannot find -lm
cannot find -lc
I searched and found it has something to do with /usr/bin/ld
. Which is a symlink (I hope) to lbd.bdf
. I pasted that file in the directory from Ubuntu of some friends PC. It didn't work.
I found that -lc
means include static library libc.a.
-lm
I found the开发者_如何学Pythonm in my i386-linux-folders
(name was something different).
I tried code blocks but same errors.
The compiler cannot find static glibc, you might have installed only the shared libraries, try:
yum install glibc-static
make sure that your libpath (in g++) points to the directory(ies) that libm.a and libc.a are located in (use the -L option)
ld
is the GNU linker.
man ld
ld combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run ld.
It is uses to link your program with the C library and the C math library. You need to make sure that libc6-dev
is installed:
foo@bar: $ dpkg -s libc6-dev
Or more generic, ensure build-essential
, which depends on a handful of essential C packages.
foo@bar: $ dpkg -s build-essential
精彩评论