Sunday, April 10, 2022

[SOLVED] Cannot find -lc and -lm in g++ linux

Issue

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.
similarly for -lm

I found them in my i386-linux-folders (name was something different).

I tried code blocks but same errors.


Solution

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)



Answered By - KevinDTimm
Answer Checked By - Clifford M. (WPSolving Volunteer)