Linux .C Src File Question
Results 1 to 2 of 2

Thread: Linux .C Src File Question

  1. #1
    Junior Member
    Join Date
    Sep 2002

    Linux .C Src File Question

    I am using Mandrake Linux 9.0 and I have like all the workstation packages installed. Anyways, I need to know how to run .c files in Linux. I understand that they need compiled first into machine code that the cpu can read, and then linked and made into executables or whatever. Anyways, assuming that I had a file called "test.c" in my /home/usr directory............ what would the steps in order be to successfully do all of the above. Also, do I do this in a term like "X" or from bash or what ? Some guy told me over MIRC to do this:

    gcc -o "test" "test.c"

    and go from there or whatever ? Could someone be kind enough to give me the actual working steps of running a single source .c file ? Thanx.


  2. #2
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Yes, if you had a c source file named test.c, then you
    type the command:

    gcc -o "test" "test.c"
    and the compiler will (if all goes well), create an executable
    program with the name "test". You then run the program by
    typing ./test . It is necessary to preceed the name with "./"
    (dot slash) unless the file is in a directory that is named
    in the path environment variable.

    BTW, there is a command by the name of "test" already
    on your system, so it would be best not to use it as a name
    for any of your own creations.
    I came in to the world with nothing. I still have most of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts