| |||||||||||
| |||||||||||
undefined reference to typeinfo - C++ error message
There are some compiler and loader error messages that shout obviously as to their cause, but there are others that simply don't give the new user much of an indication as to what's really wrong. And most of those I get to know pretty quickly, so that I can whip around a room during a course, making suggestions to delegate to check for missing ; characters or double quotes, to check that they have used the right type of brackets for a list subscript and haven't unintentionally written a function call, etc.
Here's one of the more obscure messages from the Gnu C++ compiler - or rather from the loader: g++ -o polygon shape.o circle.o square.o polygon.oAnd you can be scratching you head for hour over that one! The error? shape.o contains a base class from which classes are derived in circle.o and square.o .. but virtual function(s) in shape's definition are missing null bodies. The fix? You've got line(s) like virtual float getarea() ;that should read virtual float getarea() {} ; The complete (working) source code files for this example are available here (written 2006-07-15 06:22:59)
Associated topics are indexed under C234 - C and C based languages - Further C++ Object Oriented features
Some other Articles
Check your user is human. Have him retype a word in a graphicMelksham Carnival Parade The Courts, Holt Not shouting undefined reference to typeinfo - C++ error message Simple polymorphism example - C++ Effective web campaign? The case for exceptions References and Pointers in C++ Writing up new C / C++ notes. 1634 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||