[SOLVED] Linker Settings

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
fmc
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 01, 2019 7:31 pm

[SOLVED] Linker Settings

Post by fmc » Fri Dec 13, 2019 9:08 am

doublemax pointed me to a solution to fix my many errors when trying to compile the form you get when creating a wxWidgets app with C::B. The solution was to add four extra libraries, giving me a total of six libraries for the linker to link.

My questions is this: HOW do you know what libraries to link/add? The error log didn't show me anything that I recognized as a clue to add the other four libraries. So how do you know? This is a list of the errors I had. I posted them and that's when doublemax replied with a solution from another post that fixed this issue by adding the other libraries. So how do you determine...how wld I determine what libraries I'm suppose to add?
Last edited by fmc on Fri Dec 13, 2019 10:16 am, edited 1 time in total.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2157
Joined: Sun Jan 03, 2010 5:45 pm

Re: Linker Settings

Post by PB » Fri Dec 13, 2019 9:58 am

The official wxWidgets documentation tells you which class belongs to which library.

In practice, the libraries do not number in dozens so you can just add them all and be done with it, once can tell which files and which order based on the sample project files or there is many posts in this forum listing them as well.

You usually do it once when starting with wxWidgets and then you just copy the project settings to new ones.

fmc
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 01, 2019 7:31 pm

Re: Linker Settings

Post by fmc » Fri Dec 13, 2019 10:16 am

Hey, PB. I appreciate the response. I failed to read the wxWidgets docs, so that's my bad. I'll take my time and read them. I just thought that the errors might be pointing to the missing libraries. I was thinking the errors wld provide some sort of clue as to missing libraries the linker was missing/needing. Anyway, I'm good now and am working through some wxWidgets tutorials. I have a long way to learn all I need to be proficient, so my asking this was to see if the errors I got were clues to the needed libraries. If you don't ask, you won't know :D

Thanks.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2157
Joined: Sun Jan 03, 2010 5:45 pm

Re: [SOLVED] Linker Settings

Post by PB » Fri Dec 13, 2019 10:38 am

For example, when you see an error like this

Code: Select all

C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZN13wxSockAddressD2Ev'
It is obvious that the library with wxSockAddress is missing. If you go to wxSockAddress documentation, it lists wxNet under "Library:" When you click on the library name, you get to the libraries page, which on its top has a scheme of wxWidgets library dependencies.

As for the actual library names, it can get tricky but if you use an IDE with wxWidgets support such as Code::Blocks (and CodeLite?), its new project wizard will add the libraries for you. If you use MSVC, you do not need to add any libraries by hand as they are autolinked. If you use CMake, it should also be simple. If you are using makefiles or other ways, you need to take a look at the sample files which come with wxWidgets.

Post Reply