Search code examples
eclipsegccmingwwxwidgets

What is the right order of wxWidgets libs for MinGW Linker when building an application?


For some days now I dive into wxWidgets. I succeeded to compile the libs and build the minimal example and another example from a tutorial. All under Win 10 with MinGW GCC 12.2 and Eclipse CDT.
Now I created an XRC file and took a small program from a tutorial to use this XRC file but that produced a long list of undefined reference linker errors. Searching for a solution I found hints that it may have something to do with the order the libs are given in linker settings. Also I found the dependency diagram of the wxWidgets libs and started to resort the libs in linker settings. I managed to strongly reduce the number of errors and finally succeded with linking without any error.
Now my questions:

  • Why is the order important?
  • Is there a right order, or is it dependent on my program eg the included header files?
  • Where can I find the right order or how can I find it out? (This one time took me three hours!)
  • How can I determine which libs are needed at all?

Thanks for any help!


Solution

    1. How can I find out the order of the libraries?

    You can try to build xrc sample found in the samples\xrc directory the same way you build minimal one and look at the command generated. 2. Why is it important?

    Because if function in library A calls a function from library B the linker need to know first what is library B. It can't guess where that function in library B is. So it throws an undefined reference to function XXX.

    HTH.