Ian Walker - 2004-10-08

Hi all,

I'm getting the following errors when trying to build my project. Has anyone got any idea what is causing the "multiple definition of vtable/typeinfo" errors, and how I can fix it?

The code is a bit complex to post here, but basically I have a class called "Fixture", containing a boost::gregorian::date and two std::strings, and a class called "Result" which derives from "Fixture" and adds two ints. "Fixture" has no virtual functions.

The error occurs if I add a line which assigns the address of an object of type "Result" to a pointer-to-"Fixture", ie:

Result test1 (date(2004,10,8), "Home Team", "Away Team", 5, 3)
Fixture* pTest2 = 0;

pTest2 = &test1;

Any info would be very welcome.

Kind Regards,

Ian

(build log)

Compiler: Default compiler
Building Makefile: "C:\Projects\Footie6\Makefile.win"
Executing make...
mingw32-make.exe -f "C:\Projects\Footie6\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.2/include" -I"C:/Dev-Cpp/include"

g++.exe Fixture.o main.o Result.o -o "Footie6.exe" -L"C:/Dev-Cpp/lib" -lboost_date_time-mgw-1_31

C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$ZTVN5boost9gregorian9bad_monthE+0x0):greg_month.cpp: multiple definition of vtable for boost::gregorian::bad_month' main.o(.rdata$_ZTVN5boost9gregorian9bad_monthE+0x0):main.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTIN5boost9gregorian9bad_monthE+0x0):greg_month.cpp: multiple definition oftypeinfo for boost::gregorian::bad_month'
main.o(.rdata$_ZTIN5boost9gregorian9bad_monthE+0x0):main.cpp: first defined here
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTISt11logic_error+0x0):greg_month.cpp: multiple definition of typeinfo for std::logic_error' main.o(.rdata$_ZTISt11logic_error+0x0):main.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTVSt12out_of_range+0x0):greg_month.cpp: multiple definition ofvtable for std::out_of_range'
main.o(.rdata$_ZTVSt12out_of_range+0x0):main.cpp: first defined here
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.text$_ZTSSt11logic_error+0x0):greg_month.cpp: multiple definition of typeinfo name for std::logic_error' main.o(.rdata$_ZTSSt11logic_error+0x0):main.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTISt9exception+0x0):greg_month.cpp: multiple definition oftypeinfo for std::exception'
main.o(.rdata$_ZTISt9exception+0x0):main.cpp: first defined here
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.text$_ZTSN5boost9gregorian9bad_monthE+0x0):greg_month.cpp: multiple definition of typeinfo name for boost::gregorian::bad_month' main.o(.rdata$_ZTSN5boost9gregorian9bad_monthE+0x0):main.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTISt12out_of_range+0x0):greg_month.cpp: multiple definition oftypeinfo for std::out_of_range'
main.o(.rdata$_ZTISt12out_of_range+0x0):main.cpp: first defined here
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.text$_ZTSSt9exception+0x0):greg_month.cpp: multiple definition of typeinfo name for std::exception' main.o(.rdata$_ZTSSt9exception+0x0):main.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.text$_ZTSSt12out_of_range+0x0):greg_month.cpp: multiple definition oftypeinfo name for std::out_of_range'
main.o(.rdata$_ZTSSt12out_of_range+0x0):main.cpp: first defined here
C:/Dev-Cpp/lib/libstdc++.a(stdexcept.o)(.rdata$_ZTVSt11logic_error+0x0):stdexcept.cc: multiple definition of vtable for std::logic_error' C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj)(.data$_ZTVSt11logic_error+0x0):greg_month.cpp: first defined here C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj.b)(.text+0x78e):greg_month.cpp: undefined reference to_Unwind_Resume'
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj.b)(.text$_ZN5boost6detail12shared_countC1IPSt3mapISstSt4lessISsESaISt4pairIKSstEEENS_15checked_deleterISA_EEEET_T0
+0x8c):greg_month.cpp: undefined reference to _Unwind_Resume' C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj.b)(.text$_ZNSt8_Rb_treeISsSt4pairIKSstESt10_Select1stIS2_ESt4lessISsESaIS2_EE8_M_eraseEPSt13_Rb_tree_nodeIS2_E+0x55):greg_month.cpp: undefined reference toUnwind_Resume'
C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj.b)(.text$_ZNSt8_Rb_treeISsSt4pairIKSstESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2
+0x8c):greg_month.cpp: undefined reference to _Unwind_Resume' C:/Dev-Cpp/lib/libboost_date_time-mgw-1_31.a(greg_month.obj.b)(.eh_frame+0x12):greg_month.cpp: undefined reference to__gxx_personality_v0'

mingw32-make.exe: *** [Footie6.exe] Error 1

Execution terminated