1

I am using Ubuntu 10.10 as VM and am new to it. Until recently i could easily compile C programs from the terminal. However, as i try to compile them now it gives a message as:

/usr/bin/ld: cannot find -lc 
collect2: ld returned 1 exit status

I have searched for it over the net but could not figure out what is going wrong. I know the answer to it must be simple but any help would be appreciated. Thanks!

3
  • 2
    It seems libc.a is missing. Commented Jun 29, 2012 at 7:28
  • Are you compiling directly or via a build tool like make? If it's the former, then show us how. Commented Jun 29, 2012 at 7:31
  • Am compiling it directly. Its this way : gcc Test.c -o Test for any file, say Test.c Commented Jun 29, 2012 at 7:37

2 Answers 2

3

Installing the necessary tools should solve your problem. Try:

sudo apt-get install build-essential
Sign up to request clarification or add additional context in comments.

Comments

0

You probably -- most of us do -- installed Ubuntu desktop, but not Ubuntu server. A whole lot of tools don't come over with a default Ubuntu desktop installation.

So start by installing build-essential:

sudo apt-get install -y build-essential

Then try the compile again. build-essential contains a bunch of components that you need to perform a basic compile.

For my work, beyond build-essential, I have to install other libraries like curses. However, I first have to have build-essential installed before I can do anything else.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.