| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. DevCpp Linker error for project using XRC from wxWindows2.4.2.contrib #3177 Posted by: 2004-01-03 01:19:09 | After a fresh installation of DevCpp v.4.9.8.5 I prepared a project - based on example wxWindows application from DevCpp package - that contains the following lines in OnInit function:
wxImage::AddHandler(new wxXPMHandler); wxXmlResource::Get()->InitAllHandlers();
I added necessary headers #include "wx/image.h" #include "wx/xrc/xmlres.h"
and library -lwxxrc
And unfortunatelly got the following linker errors, they appears for all wxWindows.DevPaks version 2.4.0 and 2.4.2 that I could get. Could you please explain how to fix it without recompiling wxWindows.
Errors ( ... dots means more errors for the file already mentioned)::
Compiler: Default compiler Building Makefile: "C:ProgramyDevCppsamplesxxxxxMakefile.win" Executing make... make.exe -f "C:ProgramyDevCppsamplesxxxxxMakefile.win" all g++.exe base.o -o "Project1.exe" -L"C:/Programy/DevCpp/lib" -mwindows -lwxmsw -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -lodbc32 -ltiff -lpng -ljpeg -lzlib -lwxxrc
C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0x5c8):xmlres.cpp: undefined reference to `wxFileSystem::m_Handlers' ... C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0xb15):xmlres.cpp: undefined reference to `wxFileSystem::FindFirst(wxString const&, int)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0xc42):xmlres.cpp: undefined reference to `wxFileSystem::FileNameToURL(wxFileName const&)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0xd11):xmlres.cpp: undefined reference to `wxFileSystem::FindNext()' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0x105c):xmlres.cpp: undefined reference to `wxFileSystem::FileNameToURL(wxFileName const&)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0x1ef0):xmlres.cpp: undefined reference to `wxFileSystem::OpenFile(wxString const&)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0x2f24):xmlres.cpp: undefined reference to `wxFileSystem::ChangePathTo(wxString const&, bool)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text+0x5fce):xmlres.cpp: undefined reference to `wxFontEnumerator::EnumerateFacenames(wxFontEncoding, bool)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.data$_ZTV16wxFontEnumerator+0x8):xmlres.cpp: undefined reference to `wxFontEnumerator::EnumerateFacenames(wxFontEncoding, bool)' C:/Programy/DevCpp/lib/libwxxrc.a(xmlres.o)(.text$_ZNK12wxFileSystem12GetClassInfoEv+0x2):xmlres.cpp: undefined reference to `wxFileSystem::sm_classwxFileSystem' C:/Programy/DevCpp/lib/libwxxrc.a(xh_wizrd.o)(.text+0x320):xh_wizrd.cpp: undefined reference to `wxWizard::Create(wxWindow*, int, wxString const&, wxBitmap const&, wxPoint const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_split.o)(.text+0x761):xh_split.cpp: undefined reference to `wxSplitterWindow::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_gdctl.o)(.text+0x525):xh_gdctl.cpp: undefined reference to `wxGenericDirCtrl::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&, int, wxString const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_html.o)(.text+0x2cf):xh_html.cpp: undefined reference to `wxHtmlWindow::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_chckl.o)(.text+0x30a):xh_chckl.cpp: undefined reference to `wxCheckListBox::Create(wxWindow*, int, wxPoint const&, wxSize const&, int, wxString const*, long, wxValidator const&, wxString const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_cald.o)(.text+0x4db):xh_cald.cpp: undefined reference to `wxCalendarCtrl::Create(wxWindow*, int, wxDateTime const&, wxPoint const&, wxSize const&, long, wxString const&)' ... C:/Programy/DevCpp/lib/libwxxrc.a(xh_tree.o)(.text+0xb4b):xh_tree.cpp: undefined reference to `wxTreeCtrl::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)' ...
make.exe: *** [Project1.exe] Error 1
Execution terminated | 2. Re: DevCpp Linker error for project using XRC from wxWindows2.4.2.contrib #3188 Posted by: 2004-01-04 05:12:41 | Hi,
I also have the same problem. However I have downloaded source code for wxWindows and compiled it. Samples deliverred w/contrib compile w/o errors and work with original makefile set. The same but in DevCpp fails with errors you have reported...
I made an experiment: got source files from my project and adopted makefile from wxWindows source - works fine. It means that the source seems to be OK. However I strongly need the solution for working with DevCpp IDE without any nonstandard tricks or workarrounds.
Unfortunately, I still (after many experiments) do not have any idea... | 3. Re: DevCpp Linker error for project using XRC from wxWindows2.4.2.contrib #3189 Posted by: KaReL 2004-01-04 05:58:21 | I don't really know what this is because I'm coding in VS6...
But the calenderctrl and htmlhelp seems advanced controls... Did you include this library?
Post Edited (01-04-04 05:58)------------------------ Website: www.KaReLs0ft.be | 4. Re: DevCpp Linker error for project using XRC from wxWindows2.4.2.contrib #3191 Posted by: 2004-01-04 15:42:30 | Hello again,
I have found a problem and a solution as well. Both are completelly trivial. The solution is an order of libraries given to the linker. Everybody would link project as following:
g++ /* ... */ -lwxmsw -lwxxrc /* ... */ ^^^^^ ^^^^^
Note the order of libraries. This linkage always fails. Whatever you do. Now try to do it with alterred order:
g++ /* ... */ -lwxxrc -lwxmsw /* ... */ ^^^^^ ^^^^^
However now it works :-)
To find a problem I started to try to understand how the linker makes its job. Everybody assume that the linker collects all requested symbols and then retrieves code from objects.
I am not a linker expert (considerring to become) but it seems to work with a very subtle difference. The linker collects all requested symbols from first object than second and so on. It also retrieves the code from sequently given files. If it sees that some symbol is missing then it looks for it in a following objects but it is not going back to already processed files so won't find the one which is existing in the previous file.
Then I made an experiment: I stopped linking wxWindows like a library - ``-lwxmsw'' but like an object rather: ``../../../....../libwxmsw.a'' so all code would be linked so all needed symbols would be available... The result was surprising me... It linked code w/o errors.
Next step I've made was to change the order of given libraries and surprised again. However now being able to build my project. | 5. Re: DevCpp Linker error for project using XRC from wxWindows2.4.2.contrib #3192 Posted by: 2004-01-04 17:31:25 | Thanks Roland for your hint, I knew it must be such simple but did not think about the order of linked libraries. | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|