Results 1 to 5 of 5

Thread: compile c program at command prompt

  1. #1

    Question compile c program at command prompt

    how can we compile a c program at the command promt.


  2. #2
    Junior Member
    Join Date
    Jul 2008
    Answers
    3

    Re: compile c program at command prompt

    To compile and run a C program using a command-line C compiler, you have to go through the following steps:

    (i) Write the C program (call it ``myfile.c'') in a text editor or word processor (for example, the simple ``Hello'' program below),
    (ii) Save it as a file on your computer's hard disk,
    (iii) ``Compile it'' to a computer-executable program by entering a compile command
    at a command prompt, for example for the following C compiler programs:
    gcc -Wall -o myfile myfile.c (using the GNU C compiler, UNIX or Microsoft Windows)
    cl myfile.c (Microsoft Visual C++ command-line compiler)
    bcc32 myfile.c (Borland C/C++ compiler, Microsoft Windows)


    followed by the ``Enter'' key, and finally

    (iv) Run the program by entering

    myfile

    at a command prompt, again followed by ``Enter''. If you want to save the output of ``myfile'' as a text file ``myfile.txt'', enter instead

    myfile > myfile.txt


  3. #3
    Junior Member
    Join Date
    Oct 2008
    Answers
    12

    Re: compile c program at command prompt

    c:\>admin/student/
    c:\>admin/student/cd..
    c:\>admin/cd..
    c:\>cd tc
    c:\>cd bin
    c:\>tc


  4. #4
    Junior Member
    Join Date
    Oct 2008
    Answers
    3

    Re: compile c program at command prompt

    compiling through command promt generally people use cc followed by ur .c file name,i think more practice is needed for u


  5. #5
    Junior Member
    Join Date
    Mar 2008
    Answers
    4

    Re: compile c program at command prompt

    In linux Terminal you can use following statement to compile your program:

    g++ -o prog_name my_prog.cpp

    and

    ./prog_name

    will execute the program


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact