Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Multiple defintion of vtable

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Multiple defintion of vtable
#2960
Posted by: 2003-11-24 10:57:10
Everything used to be fine, but now I'm getting linker errors. I was using msys make, but I got rid of msys and downloaded mingw make, now I'm getting these vtable errors all  over. I tried the listctrl sample as its small and should work, but I get this:
Compiler: Default compiler
Building Makefile: "C:Dev-CppMakefile.win"
Executing  make...
mingw32-make.exe -f "C:Dev-CppMakefile.win" all
g++.exe -c base.cpp -o base.o -I"C:/mingw/include/c++"  -I"C:/mingw/include/c++/mingw32"  -I"C:/mingw/include/c++/backward"  -I"C:/mingw/include"  -I"C:/DEV-CPP/include/c++"  -I"C:/DEV-CPP/include/c++/mingw32"  -I"C:/DEV-CPP/include/c++/backward"  -I"C:/DEV-CPP/include"  -I"C:/msys/local/include" -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT  -D__WXMSW__ -D__WINDOWS__  -fmessage-length=0 -fno-exceptions -Os -fno-rtti 

g++.exe base.o  -o "Project1.exe" -L"C:/mingw/lib" -L"C:/DEV-CPP/lib" -L"C:/msys/local/lib" -mwindows -lwxmsw -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -lodbc32 -ltiff -lpng -ljpeg -lzlib

C:/DEV-CPP/lib/libwxmsw.a(mdi.o)(.data$_ZTV14wxMenuItemList+0x0):mdi.cpp: multiple definition of `vtable for wxMenuItemList'
base.o(.rdata$_ZTV14wxMenuItemList+0x0):base.cpp: first defined here

Execution terminated

I'm using upcases devpack and have (as you can see) tried altering the compile parameters to those given here to no avail. The only other thing I've changed (as far as I can recall) is upgrading to todays new dev-cpp.

What have I done wrong?
Message2. Re: Multiple defintion of vtable
#2961
Posted by: 2003-11-24 11:13:14
um.. the compile log I gave was for the empty project, not the listcrtl sample. Now for the bizzare bit, I went to compile (link really the objects were still there) said sample (with upcases parameters) so I could post its errors too and it worked!?! The inards of linking freaked me out anyway, now, well... :-/

I think I'll just  go to sleep now and try my own projects again 2mrw ;)
Message3. Re: Multiple defintion of vtable
#2962
Posted by: lea 2003-11-24 13:32:47
Was the same here...
Message4. Re: Multiple defintion of vtable
#2964
Posted by: upCASE 2003-11-24 18:19:46
Hm... Strange!
Have you tried recompiling the whole project? I mean discarding the object files and compile everything?

I noticed that I got the same error message when trying the new release of gcc 3.3.1 instead of 3.2.3...

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message5. Re: Multiple defintion of vtable
#2968
Posted by: 2003-11-24 21:16:35
Well, I looked again this morning and it appears the projects that are linking are the ones with the old objects. If I delete the object files and re-compile then the object files are coming out about 30% smaller and not linking. I've rolled back mingw-runtime to 3.1 as it seems I updated at some point, but it has no effect.

Lea, what do you mean? What has happened to cause your errors?

I think I'll try Michaels Devpak and see if that helps.
Message6. Re: Multiple defintion of vtable
#2969
Posted by: lea 2003-11-24 21:53:32
Using 3.3 instead of 3.2 (g++).
With 3.2 it works, but not with 3.3.
Deleting everything has no effect.
Message7. Re: Multiple defintion of vtable
#2970
Posted by: 2003-11-24 22:02:12
Ok Lea, thanks. I'll try downgrading or compiling wxWindows with 3.3 myself. I'm sure I havn't upgraded anything else, looking at the release dates of mingw stuff, I must have downloaded the wrong files last time (the mingw download page is a confusing beast, with all those files, proposed, current. candidate, previous....)
Message8. Re: Multiple defintion of vtable
#2971
Posted by: 2003-11-25 01:25:58
Thanks guys, everything works again now I have 3.2 again. Despite the fact GCC 3.3 is split up and 3.2 wasn't and thinking 'hmmm I recall reading 3.3 has 30% smaller objects' when writing that line, it just didn't click. It's because it was moved from candidate to current, but of course the date didn't change. I will have a go at building for 3.3 if no-one beats me to it, not right now because once again the zips are corrupt, think it's fresh downloads fault.

Anyway someone better get out the chalk so I can be added to the stupid mistakes board.
Message9. Re: Multiple defintion of vtable
#2972
Posted by: lea 2003-11-25 02:48:18
Hm, when you link your wxWindows give the linker the param -s.
Means something like strip.
Makes your exec much smaller, for me it was 2mb before and 1mb after.
Still way too big, anyway.
I would love to use 3.3 over 3.2, but with this ugly linker error, seems like i have to wait.



Post Edited (11-25-03 02:49)
Message10. Re: Multiple defintion of vtable
#2977
Posted by: 2003-11-25 22:15:40
Yeah I know of strip, but I use the separate one on final release, I have this batch file, 'bigfinish.bat':
C:mingwbinstrip.exe %1
C:DevEToolsupx.exe --best %1
@echo off
cls
exit
which I send '<EXENAME>' from the tools menu. That way I can strip and upx all in one go at the end. There's probably more and some fine tuning I can get to that. I know you can send 's' to strip to make it more effective, but I'm not sure how safe that is.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0