User forums > Using Code::Blocks

Linking error when copmpling a wxwidgets-2.6.3 project created from wizards

<< < (2/2)

MortenMacFly:

--- Quote from: mikewolfli on August 24, 2006, 10:07:53 am ---i think the system lib should be in c:\codeblocks\lib(.a)
but still the problem.

--- End quote ---
They are there, but to link against any of those you have to tell this to the linker.
Thus:
- make sure your linker include path contains c:\codeblocks\lib (assuming you have the gcc libs (*.a) there)
- make sure you add the specific libs to link agains in the project's build options (linker tab), just as you added the wxwidgets lib(s).

The linker does not "search and link". The linker only links the libs you tell him to link. And you haven't told the linker to link any of the system libs, only the wxWidgets ones (I suppose).

Please have a look at my sig to see the full build log which will reveal what exactly your linker command looks like. Feel free to post the full log again (you can skip everything after the first error).

You may also use the wx project wizard of C::B to see how this wizards sets up the project (what folders, what libs and so on...) to compare this with your settings.

With regards, Morten.

thomas:
As Morten already said, adding the paths is not enough, you must add the required library names, too (not only in this case, but in general).

Searching Google for wxwidgets undefined reference InitCommonControls (or any of the other missing references -- which IMO would be the first obvious thing to do) gets you a lot of results that explain the source of these errors and that explain which libraries you need to link with.

You need at least this set of libraries (written down from memory, may be incomplete):
ole32 wsock32 comctl32 shell32 oleaut32 advapi32 uuid gdi32 winmm comdlg32

mikewolfli:
thank you very much, i add the libadvapi32.a libcomctl32.a libctl3d32.a libglu32.a libodbc32.a libole32.a liboleaut32.a libshell32.a libuuid.a libwinspool.a libwinmm.a libwsock32.a libgdi32.a libcomdlg32.a in the linker tab, also add the all wxlib in the linker tab of the build options  as all you said . and rebuild it , succeed.
 
thank you .

 and   i find that in the wizard template  , all of libraries' name, if you add the lib at th e head of them , in the linker tab of the build options will display the right lib name . not the name lack of "lib".
 
 also i change the wizard script,
*:\CodeBlocks\share\CodeBlocks\templates\wizard\wxwidgets

        if (IsMonolithic)
            lib_name = lib_name + _T("wxmsw26");
        else
            lib_name = lib_name + _T("wxbase26"); // TODO: how are non-monolithic files named???

and add the wxmsw26*_core.a to the link when monolithic = 0;

thank you very much.

sethjackson:

--- Quote from: mikewolfli on August 25, 2006, 03:54:32 am ---thank you very much, i add the libadvapi32.a libcomctl32.a libctl3d32.a libglu32.a libodbc32.a libole32.a liboleaut32.a libshell32.a libuuid.a libwinspool.a libwinmm.a libwsock32.a libgdi32.a libcomdlg32.a in the linker tab, also add the all wxlib in the linker tab of the build options  as all you said . and rebuild it , succeed.
 
thank you .

 and   i find that in the wizard template  , all of libraries' name, if you add the lib at th e head of them , in the linker tab of the build options will display the right lib name . not the name lack of "lib".
 
 also i change the wizard script,
*:\CodeBlocks\share\CodeBlocks\templates\wizard\wxwidgets

        if (IsMonolithic)
            lib_name = lib_name + _T("wxmsw26");
        else
            lib_name = lib_name + _T("wxbase26"); // TODO: how are non-monolithic files named???

and add the wxmsw26*_core.a to the link when monolithic = 0;

thank you very much.


--- End quote ---

Umm I cannot read that color. It is too bright.

Here is the list for wxMSW.

wxbase26.lib                 wxbase26d.lib
wxbase26_net.lib           wxbase26d_net.lib
wxbase26_xml.lib           wxbase26d_xml.lib
wxmsw26_core.lib          wxmsw26d_core.lib
wxmsw26_html.lib          wxmsw26d_html.lib
wxmsw26_adv.lib           wxmsw26d_adv.lib

From here. I just changed the version name. ;)

http://biolpc22.york.ac.uk/pub/2.6.3/install-msw-2.6.3.txt

Navigation

[0] Message Index

[*] Previous page

Go to full version