hi
i get a linker error when compiling on fedora core 4 (gcc4, wx2.4):
Linking executable devel/codeblocks.exe...
.objs/src/app.o(.gnu.linkonce.t._ZN13CodeBlocksAppC1Ev[CodeBlocksApp::CodeBlocksApp()]+0x16): In function `CodeBlocksApp::CodeBlocksApp()':
src/app.cpp:77: undefined reference to `vtable for CodeBlocksApp'
collect2: ld returned 1 exit status
make: *** [devel/codeblocks.exe] Error 1
does anyone know what this is about?
thanks
Quote from: matthi
i get a linker error when compiling on fedora core 4 (gcc4, wx2.4):
Linking executable devel/codeblocks.exe...
.objs/src/app.o(.gnu.linkonce.t._ZN13CodeBlocksAppC1Ev[CodeBlocksApp::CodeBlocksApp()]+0x16): In function `CodeBlocksApp::CodeBlocksApp()':
src/app.cpp:77: undefined reference to `vtable for CodeBlocksApp'
collect2: ld returned 1 exit status
make: *** [devel/codeblocks.exe] Error 1
does anyone know what this is about?
thanks
Can you post more of the error? preferably the command being executed to link codeblocks.exe, it looks as if the linker is not linking with all the correct libraries.
thanks for the reply.
i posted the whole error that was printed to the shell, but from exploring the makefile i deduced that `wx-config --libs` is run to determine what to link the program with. on my system this command produces the following result:
-pthread -lwx_gtk2-2.4
is this all that is required?
thanks
p.s. i noticed that in the unix makefile the line which links the executable includes "-mwindows". correct me if im wrong, but is this not incorrect?
-mwindows means "no console window". I think it applies to both unix and windows.
-mwindows applies only to windows.
Anyway, tomorrow I 'll update the unix project files too,
Now, concerning the error you 're getting, I can't think of anything. I haven't seen this error before and my only suggestion would be rebuilding the project, in case something screwed up.
Also I notice you 're using gcc 4. I'm not saying something's wrong with it, just that it's a pretty recent release and it ***might*** have some bugs.
If I were you and couldn't figure out what's wrong, I 'd try with an older (and proven to be stable) gcc version, like 3.4.
Yiannis.
thanks for the advice, i shall try gcc 3.4 tomorrow
Well, i just tried did a cvs checkout and got it to compile first time on Mandriva 2005! But, when i try to run codeblocks.exe in output, it says:
./codeblocks.exe: error while loading shared libraries: libcodeblocks.so: cannot open shared object file: No such file or directory
I ran make -f Makefile.unix update. Has this replaced the shell script?
p.s. i couldn't be bothered to try with fc4
Sorry, forgot to login!
I got it to work by copying libcodeblocks.so to /usr/lib. Is there no way to run it from its own directory properly, because there is no longer a "run.sh" script.
Thanks
QuoteIs there no way to run it from its own directory properly, because there is no longer a "run.sh" script.
run.sh is created when you run the update script.
Yiannis.
I couldn't find run.sh anywhere in the cvs version (probably me being stupid). So i downloaded the final-beta, ran make -f Makefile.unix update, and copied the script to the cvs version's directory. With a bit of path tweaking in the script voila! :D
Edit:
To make everything work i needed to run codeblocks with the --prefix option and rename the wxwindows templates to have a capital second w (i.e. wxWindows.* instead of wxwindows.*)
Hi!
I have the same problem. Using fc4 (gcc 4.0.1, wx 2.4.2). Link error:
Linking executable devel/codeblocks.exe...
.objs/src/app.o(.gnu.linkonce.t._ZN13CodeBlocksAppC1Ev[CodeBlocksApp::CodeBlocksApp()]+0x16): In function `CodeBlocksApp::CodeBlocksApp()':
src/app.h:37: undefined reference to `vtable for CodeBlocksApp'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxListStringNode::~wxwxListStringNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxMenuItemListNode::~wxwxMenuItemListNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxMenuItemListNode::~wxwxMenuItemListNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `vtable for wxFileProto'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxListStringNode::~wxwxListStringNode()'
collect2: ld returned 1 exit status
make: *** [devel/codeblocks.exe] Error 1
Tryed codeblocks-1.0-rc1-1 and codeblocks CVS versions. Any idea?
Progress report:
I was able so solve some gcc4 compile errors. I applyed 2 patches for wxGTK-2.4.2, found here: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=154958
This solved these errors:
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxListStringNode::~wxwxListStringNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxMenuItemListNode::~wxwxMenuItemListNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxMenuItemListNode::~wxwxMenuItemListNode()'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `vtable for wxFileProto'
/usr/local/lib/libwx_gtk2-2.4.so: undefined reference to `wxwxListStringNode::~wxwxListStringNode()'
but it still won't compile, now I get just this:
Linking executable devel/codeblocks.exe...
.objs/src/app.o(.gnu.linkonce.t._ZN13CodeBlocksAppC1Ev[CodeBlocksApp::CodeBlocksApp()]+0x16): In function `CodeBlocksApp::CodeBlocksApp()':
src/app.h:37: undefined reference to `vtable for CodeBlocksApp'
collect2: ld returned 1 exit status
make: *** [devel/codeblocks.exe] Error 1
I believe this is gcc4 isue. Searched the web, but no luck :?.
P.S.: wxGTK examples compile without problems.
Are you compiling via the makefile.unix ? I've done it without a single problem.
Yes. I followed instructions from wiki. Did you used gcc3.4 or gcc4 ?
I use GCC 3.4
I'm having the same problem with gcc 4. It looks like gcc 4 really wants those virtual destructors. I get lots of warnings that they are missing, and then linking fails.
I think that, in the C++ standard, virtual destructors are not mandatory. It seems to be a bug from gcc4.
Anyway, it's a good habit to use virtual destructors, so IMHO we should change all the offending destructors in C::B!
Any progress on this yet? I use Fedora Core 4 with gcc 4.0, and I'd really like to try out Code::Blocks. I've been running into a few problems trying to compile gcc 3.4 from source, so I'd rather just be able to compile with 4.0. Is there any easy way to fix this?
EDIT: Okay, turns out it does work if I use wxWidgets 2.6.2 and the CVS version of C::B (downloaded at night on Oct 18, whatever version that might be). From there I just followed the instructions on the wiki, including the bootstrapping and everything shown at the bottom. Hopefully whatever was fixed to get rid of the 'undefined reference to vtable' errors will be included in the actual release sometime soon.