cannot find -lc and -lm in g++ linux

前端 未结 3 1115
花落未央
花落未央 2021-02-07 14:22

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

相关标签:
3条回答
  • 2021-02-07 14:30

    the compiler cannot find static glibc, you might have installed only shared libraries
    try

    yum install glibc-static

    0 讨论(0)
  • 2021-02-07 14:48

    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
    
    0 讨论(0)
  • 2021-02-07 14:49

    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)

    0 讨论(0)
提交回复
热议问题