/usr/bin/ld: cannot find -lc 解决

1300阅读 0评论2014-10-23 openwrt
分类:C/C++

[linux_day01]#cc -static hello.c 
/usr/bin/ld: cannot find -lc
collect2: ld 返回 1


主要原因是,在安装Linux时,如果不选择开发环境,会默认安装需要的动态库,但不会安装静态库。如果我们在静态连接程序时,会找不到libc.a这个基础静态库文件。这时我们安装相应的库文件就可以了:

[linux_day01]#yum install -y glibc-static libstdc++-static
上一篇:gcc ——“cannot execute binary file”
下一篇:Directory index forbidden by Options directive的解决办法