Thread: Definitions for gcc errors and warnings?

  1. #1
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545

    Definitions for gcc errors and warnings?

    Hi,
    I mostly use Visual C++ which gives you a C#### or LKN#### number that you can refer to on the MSDN to get more info about a certain error or warning...

    I'm trying to compile some code (that I didn't write) on Linux with gcc (with the -Wall option) and I'm wondering if there is a good site that gives more details about the warnings I'm getting?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    This may give you a start:
    http://icecube.wisc.edu/%7Edglo/gcc-warnings.html

    I usually just do a search with the warning text within double-quotes.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cpjust View Post
    Hi,
    I mostly use Visual C++ which gives you a C#### or LKN#### number that you can refer to on the MSDN to get more info about a certain error or warning...

    I'm trying to compile some code (that I didn't write) on Linux with gcc (with the -Wall option) and I'm wondering if there is a good site that gives more details about the warnings I'm getting?
    Can you give an example of a confusing warning you've seen? I find that GCC's warnings are usually quite good.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Seems like some other people are looking for a "definitive list of gcc compiler warning messages" as well.
    http://groups.google.com/group/gnu.g...59d94e600261d1
    http://groups.google.com/group/gnu.g...80f4b29203344e
    http://groups.google.com/group/gnu.g...cc15001476d508
    http://groups.google.com/group/gnu.g...0a43b1c7513516

    Don't bother clicking on the links -- no one ever found anything.

    I think that the best way to learn about GCC's warnings is to do what the previous posters in this thread suggested.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by dwks View Post
    Seems like some other people are looking for a "definitive list of gcc compiler warning messages" as well.
    http://groups.google.com/group/gnu.g...59d94e600261d1
    http://groups.google.com/group/gnu.g...80f4b29203344e
    http://groups.google.com/group/gnu.g...cc15001476d508
    http://groups.google.com/group/gnu.g...0a43b1c7513516

    Don't bother clicking on the links -- no one ever found anything.

    I think that the best way to learn about GCC's warnings is to do what the previous posters in this thread suggested.
    They didn't look that hard:
    http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc.pdf
    page 40 or so starts listing the options for what warnings you can enable/disable with -Wsomething.

    And there is of course always THE BEST documentation: The source 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.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >And there is of course always THE BEST documentation: The source code :-)
    The most accurate, perhaps, but have you ever tried reading gcc's source code?
    My best code is written with the delete key.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by matsp View Post
    They didn't look that hard:
    http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc.pdf
    page 40 or so starts listing the options for what warnings you can enable/disable with -Wsomething.

    And there is of course always THE BEST documentation: The source code :-)

    --
    Mats
    But that doesn't actually tell you what the text for actual errors and warnings mean, which I think is what the OP was looking for, and what the people in my links were seeking.

    [edit]
    >And there is of course always THE BEST documentation: The source code :-)
    The most accurate, perhaps, but have you ever tried reading gcc's source code?
    No, but something I was reading recently said this:
    The problem is that looking at implementations like Python (quite complex), Java (very complex), or GCC (something beyond merely very complex), reveals too much detail to easily uncover the big picture.
    [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #8
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by matsp View Post
    They didn't look that hard:
    http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc.pdf
    page 40 or so starts listing the options for what warnings you can enable/disable with -Wsomething.
    That's when you know the warnings you want and you want to specify them. I think the OP wants an explanation of the warnings emitted when you don't know them.

    For example, I searched for "initialization discards const from pointer target type" in the manual and it turned up nothing; not even for "initialization discards". It found "discards" twice.
    Last edited by Dave_Sinkula; 10-03-2007 at 02:00 PM. Reason: Pokey again. :(
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >reveals too much detail to easily uncover the big picture.
    That depends on your definition of "the big picture" and what you're really looking for.
    My best code is written with the delete key.

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by dwks View Post
    But that doesn't actually tell you what the text for actual errors and warnings mean, which I think is what the OP was looking for, and what the people in my links were seeking.
    Maybe I should have made the smiley about 36 points in size. I was meaning to be completely sarcastic with that comment.

    I agree with whoever it was that said that gcc is well beyond very complex. I have looked at portions of the code, and even with some good indications from someone extremely familiar with that code, it was still hard to understand. It is, certainly, not a good way to find out why the compiler says "initialization discards const".

    --
    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.

  11. #11
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Thanks, I guess I'll just have to Google any errors that I can't figure out.

    All the warnings I've gotten so far were pretty easy to understand and fix. I was just hoping there was a good resource like the MSDN for gcc, just in case I get a tougher error later...

  12. #12
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I have looked at portions of the code, and even with some good indications from someone
    >extremely familiar with that code, it was still hard to understand.
    Compilers are one of the more complex programs one can write, and open source code tends to be exceptionally obtuse.

    >I was just hoping there was a good resource like the MSDN for gcc, just in case I get a tougher error later...
    There are newsgroups and mailing lists. You're most likely to get a good answer from the experts there. However, with code examples, we can probably help you as well.
    My best code is written with the delete key.

  13. #13
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    There are newsgroups and mailing lists. You're most likely to get a good answer from the experts there.
    Yeah, I usually get pretty good answers too; I just didn't want to waste people's time asking a question if there was a good site available where I could find the answer myself.
    Hey, maybe that would be a good project for someone -- setting up a 'GSDN' site.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I fix these annoying warnings and errors?
    By zyphirr in forum C Programming
    Replies: 18
    Last Post: 11-12-2008, 06:19 PM
  2. Replies: 6
    Last Post: 11-06-2008, 04:06 AM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  4. Some errors and warnings i dont understand
    By lakai02 in forum C Programming
    Replies: 6
    Last Post: 10-18-2002, 11:16 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM