TechSpot

What is the use of a compiler in programming?

By Neil010
Aug 23, 2011
Post New Reply
  1. Hellp Everybody,

    I am new to the vast field of computer programing. I have started with the language "C++", and at the moment I am teaching myself from books and the internet.

    I however always have a doubt - "What is the use of a compiler?"

    What I deduced was that it is a software that compiles your lines of code into an executable file. But everytime I view posts on TechSpota and other forums dedicated to C++, I see people talking about different compilers, and that one compiles more efficiently that the other and that some have more support and you can improve by downloading plug-ins. Also, what is an IDE?

    I currently use Bloodshed's Dev C++ compiler, and it has served me well (till now at least).

    So besides compiling codes what else does a compiler do? And is Dev C++ a good choice or should I download Code::Blocks ( which I found recently after a few Google searches)?

    Yes, I did my searches on Google, but I couldn't I really find a good answer. I am in a dilemma at the moment and would be grateful if somebody helped.

    Neil010
     
  2. mikybee93

    mikybee93 TS Rookie

    I'm no expert, but as far as I've been taught, a compiler will compile your code into a single file, such as an exe. That file can then be used without the need of your code any longer, or the compiler itself. This is useful if you want to send your code to users to test, as they'll only have a single file.
    It's usually for finished code and not bug testing, as opposed to an interpreter which looks at your code and executes it line by line, stopping if there is any error. This helps find such errors. An interpreter has to have your code on hand each time you want to run your program.

    And IDE is an 'integrated development environment'. Basically, it's a program to help you program. It usually contains a compiler/interpreter within itself, along with a source code editor and a debugger sometimes.

    I'm not entirely sure how to answer your other questions, but I have heard a lot of good things about Code Blocks.

    Hope that helps!
     
  3. jobeard

    jobeard TS Ambassador Posts: 13,514   +336

    In the simplest of terms, a compiler translates human readable grammar (eg: cobol, c, c++, java) into a binary, machine readble file that can then be executed by the machine.
     
  4. Neil010

    Neil010 TS Rookie Topic Starter Posts: 57

    Thank you Mr. Beard for the help. But I just wanted to ask you... Since my compiler converts or translates the codes into binary, doesn't that make my application cross-platform, which I can then use in either systems?
     


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.