Author Topic: link errors  (Read 13817 times)

matt

  • Guest
link errors
« on: July 10, 2005, 04:47:33 am »
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

Anonymous

  • Guest
Re: link errors
« Reply #1 on: July 10, 2005, 07:37:22 am »
Quote from: matt
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


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.

matt

  • Guest
link errors
« Reply #2 on: July 11, 2005, 10:36:28 pm »
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:

Code
-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?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
link errors
« Reply #3 on: July 11, 2005, 11:17:56 pm »
-mwindows means "no console window". I think it applies to both unix and windows.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
link errors
« Reply #4 on: July 11, 2005, 11:43:30 pm »
-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.
Be patient!
This bug will be fixed soon...

matt_matrus

  • Guest
link errors
« Reply #5 on: July 12, 2005, 02:37:34 am »
thanks for the advice, i shall try gcc 3.4 tomorrow

matt

  • Guest
link errors
« Reply #6 on: July 14, 2005, 04:36:51 pm »
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:

Code
./codeblocks.exe: error while loading shared libraries: libcodeblocks.so: cannot open shared object file: No such file or directory


I ran
Code
make -f Makefile.unix update
. Has this replaced the shell script?

p.s. i couldn't be bothered to try with fc4

matt_matrus

  • Guest
link errors
« Reply #7 on: July 14, 2005, 05:07:40 pm »
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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
link errors
« Reply #8 on: July 14, 2005, 05:52:31 pm »
Quote
Is 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.
Be patient!
This bug will be fixed soon...

matt_matrus

  • Guest
link errors
« Reply #9 on: July 15, 2005, 05:46:12 pm »
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.*)

zemo

  • Guest
Re: link errors
« Reply #10 on: August 16, 2005, 01:24:31 am »
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?

zemo

  • Guest
Re: link errors
« Reply #11 on: August 16, 2005, 04:46:06 pm »
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.
« Last Edit: August 16, 2005, 04:48:57 pm by zemo »

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: link errors
« Reply #12 on: August 16, 2005, 05:46:07 pm »
Are you compiling via the makefile.unix ? I've done it without a single problem.

zemo

  • Guest
Re: link errors
« Reply #13 on: August 16, 2005, 05:59:27 pm »
Yes. I followed instructions from wiki. Did you used gcc3.4 or gcc4 ?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: link errors
« Reply #14 on: August 16, 2005, 07:51:19 pm »
I use GCC 3.4

tksuoran

  • Guest
Re: link errors
« Reply #15 on: August 30, 2005, 08:48:20 am »
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.

zieQ

  • Guest
Re: link errors
« Reply #16 on: August 30, 2005, 09:57:53 am »
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!

Link5225

  • Guest
Re: link errors
« Reply #17 on: October 19, 2005, 01:27:40 am »
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.
« Last Edit: October 20, 2005, 02:58:53 am by Link5225 »