We help IT Professionals succeed at work.

Compiling a sample c file takes forever on unix

jfz2004 asked
Medium Priority
Last Modified: 2008-03-17

I have a sample c file - test.c and I am compiling it on unix
and it is take forever and still working on it to just compile.

The command I typed in is:

% cc test.c

and the compiler I use is: /vol/opt/SUNWspro.new/bin/cc
and the file is:

      float   x, y, z, sum, avg;
      printf("Please enter 3 numbers: ");
      scanf("%f %f %f", &x, &y, &z);
      sum = x + y + z;
      avg = sum / 3.0;
      printf("The average of the three numbers is: %f\n",avg);

Why isn't it just compile and give me a.out?


Also any good and free c compiler on Windows 2000/XP?


Watch Question


Now I know what the problem is:

License Error : Cannot connect to the license server (lserv2)..
        for product(Sun WorkShop Compiler C).
        (License server may not have been started)
Cannot connect to license server (-15,12:145) Connection timed out
cc: acomp failed for test.c
Hmm, this is just a guess, but you haven't included any header files to define the printf and scanf functions, so perhaps the compiler is searching all the files in its include directories looking for a header that defines those functions.

Try adding

#include <stdio.h>

at the very top of your file.

> Also any good and free c compiler on Windows 2000/XP?

There's lots: minGW, gcc, watcom... google for "free windows c compiler" you will find them.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Ah, you are using a licensed compiler, and it can't reach the server that is managing the licenses.

You will need to talk you your IT department to figure out why.

As a start, try pinging the license server:

ping lserv2

If that works, then the license manager on the the license server is probably not running.


I searched for gcc but it seems to be a unix compiler.
Although it has something called DJGPP, but the web links in
DJGPP all failed.

I may check for minGW.

After ping lserv2 I got :
no answer from lserv2

So I know what's wrong with it.



Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.