Thread: a site with gcc warning and errors ellaboration exist?

  1. #1
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116

    Question a site with gcc warning and errors ellaboration exist?

    Hi,
    I could not find a site that has list of gcc warnings and errors and provide some explanation on each one.
    Is there such thing?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Recently discussed here:
    http://cboard.cprogramming.com/showthread.php?t=94184

    The conclusion is "no there isn't".

    I personally think that almost all of GCC's warnings and errors are pretty easy to understand (although there are some exceptions). Feel free to post errors/warnings and ask questions. It is obviously helpfull if you can provide the relevant source-code too, as that will certainly help the explaining of what's wrong in your code.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116
    Thanks,
    I just wished I could add to my firefox search engine list a search engine to look for errors of gcc.
    I have one for MSDN and if I enter there the error/warning number I am directed to a nice page with a lot of info and examples.

    but I found out that googling for the error will provide me with a satisfying answer as well. it just take a couple of minutes longer.
    But that will do.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I think there is another problem (besides cryptic error messages).

    When there is an error, the compiler can easily get confused. It doesn't know what you are trying to do... It just knows it can't interpret the code. (This can happen with any compiler)

    For example, once when I was moving some code around by "cutting & pasting", I mis-placed a bracket. There was only one little-tiny syntax error, but the compiler reported a couple-hundred errors and none of them said "mis-placed bracket". (It took me a few hours to find that little-tiny problem!)

    Usually, the first error message identifies the line with the first error (or the real error is usually one line up or down), but beyond that, the compiler is often just confused.

    Linker messages can be a bit more difficult, because you've lost the line-number information.

    When the compiler gives you a warning, it's probably nailed the real problem... It hasn't given-up completely.... It (probably) knows what you are trying to do, and it's warning you that it might be risky.
    Last edited by DougDbug; 10-10-2007 at 04:19 PM.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Doug,

    I completely agree - if you get hundreds or thousands of errors, it's most likely caused by an error at the beginning of the list [and, yes, if you are missing a bracket at teh end of a function, that can lead to all sorts of "strange" error messages].

    Unfortunately, a "further explanation" will not really help there - unless you add to the "nested function declarations isn't valid in standard C" with "This usually means that you forgot a bracket" - and of course, that's not necessarily the error that you get from missing a bracket, as it can lead to lots of other errors. Unfortunately, this is one of those that you have to figure out with another method. Using the "automatically indent the code" will quickly tell you about a missing end bracket. But there are ohter missing bits that can cause equal confusion and distress - missing semicolon, particularly on type declarations can lead to strange error messages too.

    Absolute general rule: Try fixing the first error first.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by DougDbug View Post
    When there is an error, the compiler can easily get confused. It doesn't know what you are trying to do... It just knows it can't interpret the code.
    True. Over time you build experience with these things. "Error ABC actually means I forgot a semicolon at the end of a struct definition," etc. It would be nice if there was a list of "common causes" of such errors, but I haven't found one. In truth I've seen them enough that I know what they are, and I don't make those mistakes very often.

    In general if you've got hundreds of warnings/errors, there are actually only one or two. Look at the first one, try to fix it, then recompile and see what you get.

    Linker messages can be a bit more difficult, because you've lost the line-number information.
    If you compile with debugging information, often the linker CAN report an exact line number.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 03:33 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM