Thread: Some basic questions about text editor and compiler

  1. #1
    Registered User
    Join Date
    Feb 2010

    Some basic questions about text editor and compiler

    so I have been working with C for 4 months now (not so long)

    but I am still confused about how to compile a C program..
    I am using a mac, and so far I wrote my codes with Xcode, and then I type gcc <filename>.c in terminal and at last type ./a.out to "run" them

    I really want to know what all these steps mean

    I have learn other programming languages as well, why sometimes there is a "run" button in the text editor?

    And I have heard of emacs, vim and jedit , RunC and ubuntu...
    all these all text editor?

    Do all of you guys run a C program in the same way?

  2. #2
    Registered User
    Join Date
    Nov 2008
    The Editors are just used to type your code . You can not run it straightaway,because it can not understand by the computer . You need to compile it to remove the errors and make that as a object file .For that reason you are using gcc filename .It will give you a object file(a.out) which will have the execute permission with it . You can get the output by executing the a.out file.

    gcc have some number of options for various usage .

             man gcc
    Last edited by karthigayan; 03-30-2010 at 06:09 AM.

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    The compiler basically translates your code into machine code that the CPU can read.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Toronto, Canada
    I thought Xcode is an Integrated Development Environment - which means it has an integral editor - with whatever "run" button or icon which makes it compile (if needed) and run. No need to go to a terminal session to type gcc...

    Most IDEs have built-in editors. They provide some additional features like coloring sections of code, indenting, context sensitive error messages, breakpoints...

    If the editor is stand-alone and just a simple generic text file editor, then it will have no "run" button. It just manipulates text and is not tied to any compiler. Such as Notepad or equivalent on the Mac.

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Definitely a build-and-run button in Xcode. I don't remember, and am not at a Mac right now to check, whether Xcode will deal with just-a-file-and-not-a-project; I have a vague recollection that they went the MS route and do not allow compilation of single files, but require having a project set up to build.

Popular pages Recent additions subscribe to a feed