GCC's Unhelpful Error Messages

Ben Mesander

Something must be done about the obtuse error messages issued by the GCC compiler, particularly when using C++ and STL classes.

Take this, for example, which is the output I got recently after a one-line change:

src/emmserver.cpp:739: error: conversion from 'std::_Rb_tree_iterator<std::pair<const unsigned int, EMMServer::EMM> >' to non-scalar type 'std::_Rb_tree_iterator<std::pair<const unsigned int, std::map<short unsigned int, EMMServer::EMMSource, std::less<short unsigned int>, std::allocator<std::pair<const short unsigned int, EMMServer::EMMSource> > > > >' requestedsrc/emmserver.cpp:740: error: no match for 'operator==' in 'j == ((EMMServer*)this)->EMMServer::mEMMSources. std::map<_Key, _Tp, _Compare, _Alloc>::end [with _Key = unsigned int, _Tp = EMMServer::EMM, _Compare = std::less<unsigned int>, _Alloc = std::allocator<std::pair<const unsigned int, EMMServer::EMM> >]()' /usr/lib/gcc/powerpc-unknown-linux-gnu/4.1.2/include/g++- v4/bits/stl_tree.h:210: note: candidates are: bool std::_Rb_tree_iterator<_Tp>::operator==(const std::_Rb_tree_iterator<_Tp>&) const [with _Tp = std::pair<const unsigned int, std::map<short unsigned int, EMMServer::EMMSource, std::less<short unsigned int>, std::allocator<std::pair<const short unsigned int, EMMServer::EMMSource> > > >]

Unfortunately, this jumbled code continued for 20+ more lines.

Andy Balaam has a humorous blog post where—almost as an aside—he generates a 1950-byte error message from a source program of only 181 bytes.

There is clearly a problem when someone starts an open source project just to post-process compiler error messages so as to make them readable. I often use STLFilt, and it’s very helpful, however it’s fixing a problem that shouldn’t exist in the first place. Our compiler tools should be better at producing useful error messages that are more readable for us. 

This problem was brought to the attention of the GCC development team almost exactly five years ago today. Unfortunately, they’ve chosen the side of pedantic correctness versus producing a tool that could be more useful to their end users.

Next Steps

As soon as I have a break on my current project — I’m planning to investigate Clang/LLVM; a new compiler technology. I’m hopeful because they list expressive diagnostics as one of their goals. However, they do not yet support C++. 

Ben Mesander has more than 18 years of experience leading software development teams and implementing software. His strengths include Linux, C, C++, numerical methods, control systems and digital signal processing. His experience includes embedded software, scientific software and enterprise software development environments.

Cardinal Peak
Learn more about our Audio & Video capabilities.

Dive deeper into our IoT portfolio

Take a look at the clients we have helped.

We’re always looking for top talent, check out our current openings. 

Contact Us

Please fill out the contact form below and our engineering services team will be in touch soon.

We rely on Cardinal Peak for their ability to bolster our patent licensing efforts with in-depth technical guidance. They have deep expertise and they’re easy to work with.
Diego deGarrido Sr. Manager, LSI
Cardinal Peak has a strong technology portfolio that has complemented our own expertise well. They are communicative, drive toward results quickly, and understand the appropriate level of documentation it takes to effectively convey their work. In…
Jason Damori Director of Engineering, Biamp Systems
We asked Cardinal Peak to take ownership for an important subsystem, and they completed a very high quality deliverable on time.
Matt Cowan Chief Scientific Officer, RealD
Cardinal Peak’s personnel worked side-by-side with our own engineers and engineers from other companies on several of our key projects. The Cardinal Peak staff has consistently provided a level of professionalism and technical expertise that we…
Sherisse Hawkins VP Software Development, Time Warner Cable
Cardinal Peak was a natural choice for us. They were able to develop a high-quality product, based in part on open source, and in part on intellectual property they had already developed, all for a very effective price.
Bruce Webber VP Engineering, VBrick
We completely trust Cardinal Peak to advise us on technology strategy, as well as to implement it. They are a dependable partner that ultimately makes us more competitive in the marketplace.
Brian Brown President and CEO, Decatur Electronics
The Cardinal Peak team started quickly and delivered high-quality results, and they worked really well with our own engineering team.
Charles Corbalis VP Engineering, RGB Networks
We found Cardinal Peak’s team to be very knowledgeable about embedded video delivery systems. Their ability to deliver working solutions on time—combined with excellent project management skills—helped bring success not only to the product…
Ralph Schmitt VP, Product Marketing and Engineering, Kustom Signals
Cardinal Peak has provided deep technical insights, and they’ve allowed us to complete some really hard projects quickly. We are big fans of their team.
Scott Garlington VP Engineering, xG Technology
We’ve used Cardinal Peak on several projects. They have a very capable engineering team. They’re a great resource.
Greg Read Senior Program Manager, Symmetricom
Cardinal Peak has proven to be a trusted and flexible partner who has helped Harmonic to deliver reliably on our commitments to our own customers. The team at Cardinal Peak was responsive to our needs and delivered high quality results.
Alex Derecho VP Professional Services, Harmonic
Yonder Music was an excellent collaboration with Cardinal Peak. Combining our experience with the music industry and target music market, with Cardinal Peak’s technical expertise, the product has made the mobile experience of Yonder as powerful as…
Adam Kidron founder and CEO, Yonder Music
The Cardinal Peak team played an invaluable role in helping us get our first Internet of Things product to market quickly. They were up to speed in no time and provided all of the technical expertise we lacked. They interfaced seamlessly with our i…
Kevin Leadford Vice President of Innovation, Acuity Brands Lighting
We asked Cardinal Peak to help us address a number of open items related to programming our systems in production. Their engineers have a wealth of experience in IoT and embedded fields, and they helped us quickly and diligently. I’d definitely…
Ryan Margoles Founder and CTO, notion