• C

Compiling a sample c file takes forever on unix

Hi,

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:

main()
   {
      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?

Thanks,

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

Jennifer

jfz2004Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jfz2004Author Commented:
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
0
waysideCommented:
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.
0
waysideCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jfz2004Author Commented:
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.

Thanks.

Jennifer

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.