Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

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

0
jfz2004
Asked:
jfz2004
  • 2
  • 2
2 Solutions
 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now