Compiling a sample c file takes forever on unix

Posted on 2006-04-04
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/
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?


Question by:jfz2004

    Author Comment

    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
    LVL 14

    Assisted Solution

    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.
    LVL 14

    Accepted Solution

    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.

    Author Comment

    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.




    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Microsoft vcsetup.exe and vcssetup.exe 8 380
    Which checksum is this? 7 132
    Adjust Mfcapp 29 143
    Trouble linking program with -lcrypt 3 126
    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode ( They will have you believe that Unicode requires you to use…
    The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now