I love g++ error messages

#include <map>
#include <string>
#include <algorithm>
using namespace std;
void main( int argc, char *argv[] ){
    map< map<string,string>, map<string,string> > hoh;
    sort( hoh.begin(), hoh.end() );
}

Do you see an error here? How big the error message is? Try compile it with g++ and you’ll have a lot of joy reading compiler output.

PS Am I the only person who thinks that error messaging is seriously broken in GNU Tools (gcc autotools gmake …)?

Advertisements

4 responses to this post.

  1. Posted by Eric Melski on April 20, 2011 at 21:34

    You may find stlfilt useful: http://www.bdsoft.com/tools/stlfilt.html. Using that tool, g++’s enormous error message in for this case is vastly simplified, so that it is easier to see the “real” problem:

    stl_algo.h:5220: error: no match for ‘operator-’ in ‘__last – __first’

    which is to say, you can’t use sort() on a map because map iterators are not RandomAccessIterators (they have no operator- and operator+).

    Reply

  2. Posted by f0rbidik on May 23, 2011 at 07:40

    It seems like you’re only guy who tends to sort BST. 🙂

    Reply

  3. I for one welcome our new Clang overlords. Especially when it comes to error messages.

    Reply

  4. Agree, GNU tools (GCC, gMake, autotools) tend to have extremely horrible error messaging system. Clang is definitely a step forward in the right direction.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: