bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/11793] New: Add suggestion to error "undefined reference to `vta


From: phresnel at gmail dot com
Subject: [Bug ld/11793] New: Add suggestion to error "undefined reference to `vtable for XXX'"
Date: 7 Jul 2010 06:54:58 -0000

I previously entered this to gcc-bugs:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44841 :

"It was today that I stumbled over the seemingly simple situation of tweaking
some bits of an interface class. 

Upon doing that, I got an undefined reference to a vtable.

I made clean and made my application. Nothing changed. Then I checked again the
interface and didn't find anything. Then I checked all derivations. Nothing.

Of course it was just me who has been a fool for not recognising a missing
character-tuple " = 0" behind a function signature, as in:

struct IFoo { 
    virtual ~IFoo() {}
    virtual void frob (); // <-- missing pure specifier
}; 
struct Foo : IFoo { virtual void frob () {} }; 
int main () {
    IFoo *f = new Foo();
    f->frob();
    delete f;
}


The exact error message was

  "undefined reference to `vtable for IFoo'"

As this costed me a not irrelevant amount of time, and I wouldn't describe me
as unexperienced, my proposal would be to add a suggestion in case of undefined
vtable"


Maybe a suggestion like "Did you intend to make it a
pure virtual function? Add `= 0' then. Otherwise, ensure to define the
function." could be added, which in this case would have saved me some 
productivity.

-- 
           Summary: Add suggestion to error "undefined reference to `vtable
                    for XXX'"
           Product: binutils
           Version: 2.20
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: phresnel at gmail dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11793

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]