On 7/30/2015 2:48 AM, Gisle Vanem wrote: > Edward Diener wrote: > >> If I remove the declaration and definition of ex_xml_exception::what(), >> since it is not needed, when linking I get: >> >> throw_exception_ex.o:throw_exception_ex.cpp:(.rdata$_ZTV16ex_xml_exception[__ZTV16ex_xml_exception]+0x20): >> undefined reference to `virtual thunk to ex_exception::what() const' >> throw_exception_ex.o:throw_exception_ex.cpp:(.rdata$_ZTC16ex_xml_exception4_12ex_exception[__ZTC16ex_xml_exception4_12ex_exception]+0x38): >> undefined reference to `virtual thunk to ex_exception::what() const' >> collect2.exe: error: ld returned 1 exit status > > AFAICS, that is because you have virtualised the whole 'ex_exception' > class in your 'ex_xml_exception' class.
It is perfectly valid C++ to do so. Why should I get a gcc linker error for valid C++ code ? > Why? I am simply duplicating in a much simplified form code that exists elsewhere, trying to solve a far more complicated problem not of my own originally. > What happens if you virtualise > only those functions you need to specialize? I can try that. Please understand that the issue is not what may work but why valid C++ will not work. > > Another thing is to get some hints from a .map-file. > Add "-Wl,--print-map,--sort-common,--cref > file.map" at the > of the link-cmd. I will try that to see if the .map file will tell me anything about the linker error I am getting. ------------------------------------------------------------------------------ _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public