Category: 

What Is a Compilation Error?

Article Details
  • Written By: Jessica Susan Reuter
  • Edited By: C. Wilborn
  • Image By: ビッグアップジャパン
  • Last Modified Date: 24 October 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Although they mainly functioned as downspouts, gargoyles were also intended to scare people into attending church.  more...

December 3 ,  1989 :  The Cold War officially ended.  more...

A compilation error is an error in building a machine code file for a computer language. Many computer languages compile their source code into machine code files before programs can be built or executed. The most common type of compilation error is a basic syntax error; one small mistake can cause many problems with the code.

The most common object-oriented programming languages, C++ and Java®, use compilation in some form. This is significantly different from interpreted languages, that use the raw source code at runtime to execute a program. A language does not need to be inherently object-oriented in order to be compilable; C++, for example, can be structured using object-oriented or procedural programming.

The most common cause of compilation errors is a syntax error. Syntax errors are errors in the form of the raw source code, usually caused by some violation of the computer language's principles. These errors can be as simple as forgetting a semicolon at the end of a line of code, or as complex as initializing an array incorrectly. Usually, it isn't extremely difficult to find and diagnose these errors; most compilers show the errors when they are encountered and do not allow formation of machine code until the errors are fixed. Different languages use different compilers, however, so it is possible that a particular type of compilation error may be present in one language, but not in another.

Ad

Depending on the language and compiler used, one compilation error may show up as many errors. For example, forgetting a semicolon at the end of a line, when a language requires it, can cause parsing errors because the compiler doesn't know when a particular line is supposed to end. This parsing error can manifest itself as many compilation errors, making it seem as if there are suddenly horrific problems with the code instead of one small typo. In general, careful attention to obeying the rules of a computer language can prevent these types of errors. By the same token, if a sudden onslaught of compilation errors appears, the experienced programmer can usually infer that a single small mistake caused most of them.

A common misconception of novice programmers is that a compilation error will crash a computer, and this is never the case. Compilation errors are restricted to compilers, and creation of machine code rarely causes problems for an entire computer system. No program is foolproof, including a compiler, but the chances of causing problems with an entire computer just by compiling code or encountering a compilation error is extremely small. Once all compilation errors are fixed, chances are good that a program will run smoothly, as it was meant to.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email