Results 1 to 9 of 9
when i tried gcc,, i got the following error :
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
can somebody help me out,,, thanks in advance...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-08-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 9
compilation error
when i tried gcc,, i got the following error :
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
can somebody help me out,,, thanks in advance
- 09-08-2011 #2Just Joined!
- Join Date
- Mar 2007
- Location
- Bogotá, Colombia
- Posts
- 43
Hi!
We're going to need a bit more than that. What are you compiling? Can you post a little more of the error that you're getting?
As of right now, the only thing I can think of is to try an ldconfig (as root)
Code:$ sudo ldconfig
- 09-08-2011 #3Just Joined!
- Join Date
- Aug 2011
- Posts
- 9
i was trying to compile a C program. even when i tried to print "hi":
#include<stdio.h>
void main()
{
printf("hi");
}
i got the error:
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
- 09-08-2011 #4Just Joined!
- Join Date
- Mar 2007
- Location
- Bogotá, Colombia
- Posts
- 43
Well then, the error
means that either you didn't call all the libraries you need with the -l flag:Code:collect2: ld returned 1 exit status
e.g.or you just don't have the proper library installed.Code:g++ -lMylibrary -o myprogram mycode.cpp
Check that you have all the basic libraries installed.
EDIT: I just saw that the library ld is trying to find is the C library, you should start from there.
- 09-08-2011 #5
What distro are you using? Have you installed the libraries for it?
For Debian / Ubuntu and other Debian children you would runCode:sudo apt-get install build-essential
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
The Fifth Continent reborn
- 09-09-2011 #6Just Joined!
- Join Date
- Aug 2011
- Posts
- 9
thnx guyz,, problem solved
- 09-10-2011 #7I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
I'd rather be lost at the lake than found at home.
- 09-11-2011 #8Just Joined!
- Join Date
- Aug 2011
- Posts
- 9
gcc was already installed in my pc,, but dint know why i got the errors(maybe i dint had the required libraries). So i re-installed gcc with the required libraries using synaptic manager and after that programs were compiled successfully. i am using UBUNTU 2.9 UE. is it okay mike ?
- 09-11-2011 #9
Yes, that's very good. Thank you.
I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
I'd rather be lost at the lake than found at home.


Reply With Quote

