This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Showing All Build Errors with C51

How can I get the c51 compiler to show all the build errors when I compile.
When I compile it will only show me a few errors. After I fix the errors I re-compile and it show me a few more, etc

I would like to have is so all or a least more at one time.

  • The C51 Compiler shows all errors unless you disable some errors using the WARNINGLEVEL directive.

    Refer to http://www.keil.com/support/man/docs/c51/c51_warninglevel.htm.

    Jon

  • Jon;
    Try compiling the C51/Example code 'BadCode'.
    Three errors are listed. Clear the first two errors and THEN many more errors are listed.
    Bradford

  • Try compiling the C51/Example code 'BadCode'. Three errors are listed. Clear the first two errors and THEN many more errors are listed.

    Yes. This is standard behaviour for ALL C compilers.

    The errors that are listed when you first compile are the only errors the compiler detects. Some of those errors are so bad that the compiler can't actually compile some of the code. When you correct those errors, you may get more or fewer errors generated. Once you change the source file you are actually compiling a completely different program. And, the compiler is going to generate errors for that new source code. Even if there is only 1 letter different, it is still new source code. Sometimes, only the addition of a semicolon can make the difference between 100 errors and 0 errors.

    Consider the case when you misspell the #include directive. In such a case, the compiler can't actually include the contents of the header file. That's because the compiler cannot figure out what you want it to do. When you correct this error, the compiler then includes the header file (which may have errors in it). So, by correcting one error, you could easily get more errors reported.

    Consider the case of a misdeclared variable. For example, suppose you misspell int variable (as itn variable). The compiler generates an error for this. But, it also generates an error everytime variable is used. By correcting the spelling of int, you'll immediately "fix" the other errors referencing variable.

    When the compiler encounters an error, it takes some kind of action to re-synchronize the source code. If you misdeclare a function, the compiler may be forced to ignore its contents (because there is no context under which to compile it).

    Jon

  • "This is standard behaviour for ALL C compilers"

    Not just 'C' compilers - the same will be true of any language for exactly the same reasons!

  • Yes Andrew, I know of what you speak. I was trying to give Jon an opportunity to pontificate more fully on the attributes of error messages in C51.
    Bradford