Author Topic: Tracking down undefined reference errors.  (Read 3989 times)

walkeraj

  • Guest
Tracking down undefined reference errors.
« on: November 14, 2007, 09:00:02 pm »
I'm working on modifying an open source project that uses, among other things, SDL and CEGui.  I went about it the smart way.  I set up my mingw/msys/code::blocks environment first and then, one at a time, I went through all of the dependencies, compiling example programs with each one to make sure that they worked.

Unfortunately, I am receiving linking errors with CEGUI, and I have no idea how to resolve them now.  To compound the issue, the registration portion of their forums is broken and no one is responding to my request for manual registration.  The errors I'm receiving are like this:

Code
obj\Release\src\core\editor.o:editor.cpp:(.text+0x157): undefined reference to `_imp___ZN5CEGUI6StringD1Ev'
obj\Release\src\core\editor.o:editor.cpp:(.text+0x178): more undefined references to `_imp___ZN5CEGUI6StringD1Ev' follow
obj\Release\src\core\editor.o:editor.cpp:(.text+0x578): undefined reference to `_imp___ZN5CEGUI6colourC1ERKS0_'

I know that this means that the linker cannot find the symbols that the object file is referring to.  I know that these symbols don't mean
anything right away to someone who doesn't know the libraries, but, since I can't reach anyone who DOES know, what I'm wondering is if
there isn't some system I can use to track down these errors myself?

Perhaps some way I can convert these symbol names into something useful that can help me track down what I need to be including?  I
know that linking order matters, and I think I know why, but I was wondering if someone could spell it out for me as well so I know that
I have it right.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Tracking down undefined reference errors.
« Reply #1 on: November 14, 2007, 09:09:07 pm »
These missing symbols appear to be from DLL-imported declarations (the _imp__ in front), so you should try bringing in any CEGUI import libraries you can find or, if all else fails, linking with the DLL directly.

As far as linking order, it basically should be a topographical ordering: libraries that are depended upon should come after the libraries or object files that depend on them.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

walkeraj

  • Guest
Re: Tracking down undefined reference errors.
« Reply #2 on: November 14, 2007, 09:17:16 pm »
I linked in all of the CEGUI libraries and nothing changed, so I must need to link to a .dll, but there are lots of them, is there any way to narrow down the search somewhat?

Also, how is linking with .dlls directly different from using an import library?  I was under the impression that all .dll/.so files had .lib/.a files  that acted as stubs to be linked against.  Apparently, my understanding of linking is somewhat incomplete...