Undefined reference : don't get it

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
romeo9423
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 08, 2004 3:36 pm

Undefined reference : don't get it

Post by romeo9423 » Thu Dec 29, 2005 4:30 pm

I am trying to compile my project with wxWidgets 2.6.2 (winXp/Codeblocks/mingw).

Before I was using a monolithic lib but and it compiled fine but when I try not to use a monolithic it fails :

mingw32-g++.exe -LD:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib -L.\wxIFM\lib\gcc_lib -LD:\Logiciels\CodeBlocks\lib -o SmartTester.exe .objs\MainFrame.o .objs\Manager.o .objs\MsgDockBar.o .objs\PrjTree.o .objs\ProjDockBar.o .objs\SCardPrj.o .objs\SCardResMgr.o .objs\Utils.o .objs\app.o .objs\configmanager.o -lwxbase26 -lwxbase26_xml -lwxbase26_net -lwxmsw26_core -lwxmsw26_adv -lwxmsw26_xrc -lwxmsw26_html -lwxmsw26_media -lwxmsw26_ifm -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid -lwxjpeg -lwxpng -lwxtiff -lwxzlib -lwxexpat -lwxregex -lwinscard -lRpcrt4 -mwindows

D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_window.o):window.cpp:(.text+0x180b): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_wincmn.o):wincmn.cpp:(.text+0x5b3): undefined reference to `wxSystemOptions::HasOption(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_wincmn.o):wincmn.cpp:(.text+0x618): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_wincmn.o):wincmn.cpp:(.text+0xbe3): undefined reference to `wxSystemOptions::HasOption(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_wincmn.o):wincmn.cpp:(.text+0xc48): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_notebook.o):notebook.cpp:(.text+0x30ad): undefined reference to `wxSystemOptions::HasOption(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_notebook.o):notebook.cpp:(.text+0x33b1): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_dc.o):dc.cpp:(.text+0x6bea): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_sizer.o):sizer.cpp:(.text+0x133c): undefined reference to `wxClientDataContainer::~wxClientDataContainer()'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_sizer.o):sizer.cpp:(.text+0x13e0): undefined reference to `wxClientDataContainer::~wxClientDataContainer()'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_core.a(corelib_sizer.o):sizer.cpp:(.text+0x144c): undefined reference to `wxClientDataContainer::wxClientDataContainer()'
D:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib/libwxmsw26_xrc.a(xrclib_xmlres.o):xmlres.cpp:(.text+0x251c): undefined reference to `wxXmlNode::RemoveChild(wxXmlNode*)'

...


Don't know what to do.
When I compile wxIFM, it works so I don't understand what I am doing wrong...
I may add that I am using precompiled headers.

Switching to target: default
mingw32-g++.exe -Wall -g -pipe -mthreads -Winvalid-pch -include "wx_pch.h" -D__GNUWIN32__ -D__WXMSW__ -DUSE_PCH -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\wxIFM\include -ID:\Logiciels\CodeBlocks\include -c wx_pch.h -o wx_pch.h.gch
mingw32-g++.exe -Wall -g -pipe -mthreads -Winvalid-pch -include "wx_pch.h" -D__GNUWIN32__ -D__WXMSW__ -DUSE_PCH -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_lib\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\wxIFM\include -ID:\Logiciels\CodeBlocks\include -c Manager.cpp -o .objs\Manager.o
In file included from Manager.cpp:1:
...
Last edited by romeo9423 on Thu Dec 29, 2005 5:19 pm, edited 1 time in total.

toxicBunny
Super wx Problem Solver
Super wx Problem Solver
Posts: 424
Joined: Tue Jul 12, 2005 8:44 pm
Location: Alabama, USA

Post by toxicBunny » Thu Dec 29, 2005 5:00 pm

It looks like you're missing

Code: Select all

// wxSystemOptions class
#define wxUSE_SYSTEM_OPTIONS 1
in the setup.h file. Check to see if this value is set to "1" and then recompile the wxWidgets libraries. It's likely that wxIFM doesn't use the system options, so this is probably why it compiled without a problem.

-Scott

romeo9423
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 08, 2004 3:36 pm

Post by romeo9423 » Thu Dec 29, 2005 5:16 pm

toxicBunny wrote:It looks like you're missing

Code: Select all

// wxSystemOptions class
#define wxUSE_SYSTEM_OPTIONS 1
in the setup.h file. Check to see if this value is set to "1" and then recompile the wxWidgets libraries. It's likely that wxIFM doesn't use the system options, so this is probably why it compiled without a problem.

-Scott
I checked and this variable is already set to 1.

toxicBunny
Super wx Problem Solver
Super wx Problem Solver
Posts: 424
Joined: Tue Jul 12, 2005 8:44 pm
Location: Alabama, USA

Post by toxicBunny » Thu Dec 29, 2005 7:51 pm

There are generally multiple copies of the setup.h file in the wxWidgets directory. When it builds the libraries, it places a copy in the "lib" folder. If you are getting undefined references, then this value is not being read correctly or is incorrect in a different file. You may have to search for any file named "setup.h" in the wxWidgets folder and then rebuild the libraries to make sure that the system options are included.

If you can't find a place where this value is wrong, just try rebuilding the libraries using "make clean" or the "Build->Clean" option in CodeBlocks to get rid of any old files.

romeo9423
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 08, 2004 3:36 pm

Post by romeo9423 » Fri Dec 30, 2005 10:40 am

Finally I found one of my problem with static libs.
It was just the link order.
Here is the right order(the one used by wxWIdgets samples) :

wxmsw26_xrc
wxmsw26_html
wxmsw26_adv
wxmsw26_core
wxbase26_xml
wxbase26
wxtiff
wxjpeg
wxpng
wxzlib
wxregex
wxexpat
wxbase26_net
wxmsw26_media
wxmsw26_ifm
winspool
winmm
shell32
comctl32
ctl3d32
odbc32
advapi32
wsock32
opengl32
glu32
ole32
oleaut32

About dynamic libs still have this while compiling wxIFM :

Switching to target: Release Dll
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\defplugin.cpp -o .objs\src\ifm\defplugin.o
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\dragndrop.cpp -o .objs\src\ifm\dragndrop.o
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\events.cpp -o .objs\src\ifm\events.o
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\manager.cpp -o .objs\src\ifm\manager.o
src\ifm\manager.cpp:34: warning: function 'void wxRectArray::DoEmpty()' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp:34: warning: 'void wxRectArray::DoEmpty()' defined locally after being referenced with dllimport linkage
src\ifm\manager.cpp:34: warning: function 'void wxRectArray::Add(const _wxObjArraywxRectArray&, size_t)' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp:34: warning: 'void wxRectArray::Add(const _wxObjArraywxRectArray&, size_t)' defined locally after being referenced with dllimport linkage
src\ifm\manager.cpp:35: warning: function 'void wxSizeArray::DoEmpty()' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp:35: warning: 'void wxSizeArray::DoEmpty()' defined locally after being referenced with dllimport linkage
src\ifm\manager.cpp:35: warning: function 'void wxSizeArray::Add(const _wxObjArraywxSizeArray&, size_t)' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp:35: warning: 'void wxSizeArray::Add(const _wxObjArraywxSizeArray&, size_t)' defined locally after being referenced with dllimport linkage


...
src\ifm\manager.cpp: In copy constructor `wxSizeArray::wxSizeArray(const wxSizeArray&)':
src\ifm\manager.cpp:35: warning: function 'wxSizeArray::wxSizeArray(const wxSizeArray&)' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp: In member function `void wxSizeArray::RemoveAt(size_t, size_t)':
src\ifm\manager.cpp:35: warning: function 'void wxSizeArray::RemoveAt(size_t, size_t)' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp: In member function `void wxSizeArray::Insert(const _wxObjArraywxSizeArray&, size_t, size_t)':
src\ifm\manager.cpp:35: warning: function 'void wxSizeArray::Insert(const _wxObjArraywxSizeArray&, size_t, size_t)' is defined after prior declaration as dllimport: attribute ignored
src\ifm\manager.cpp: In member function `int wxSizeArray::Index(const _wxObjArraywxSizeArray&, bool) const':
src\ifm\manager.cpp:35: warning: function 'int wxSizeArray::Index(const _wxObjArraywxSizeArray&, bool) const' is defined after prior declaration as dllimport: attribute ignored
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\plugin.cpp -o .objs\src\ifm\plugin.o
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\resize.cpp -o .objs\src\ifm\resize.o
mingw32-g++.exe -pipe -mthreads -frtti -fexceptions -D__GNUWIN32__ -D__WXMSW__ -O2 -enable-auto-import -DWXMAKINGDLL_IFM -DWXUSINGDLL -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\wxWidgets-2.6.2\include -ID:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll\msw -ID:\Logiciels\wxWidgets-2.6.2\contrib\include -I.\include -I.\src\ifm\xpm -ID:\Logiciels\CodeBlocks\include -c src\ifm\definterface.cpp -o .objs\src\ifm\definterface.o
mingw32-g++.exe -shared -Wl,--output-def=lib\gcc_dll\libwxmsw26_ifm.def -Wl,--out-implib=lib\gcc_dll\libwxmsw26_ifm.a -Wl,--dll -LD:\Logiciels\wxWidgets-2.6.2\lib\gcc_dll -LD:\Logiciels\CodeBlocks\lib .objs\src\ifm\defplugin.o .objs\src\ifm\dragndrop.o .objs\src\ifm\events.o .objs\src\ifm\manager.o .objs\src\ifm\plugin.o .objs\src\ifm\resize.o .objs\src\ifm\definterface.o -o lib\gcc_dll\libwxmsw26_ifm.dll -lwxmsw26_xrc -lwxmsw26_html -lwxmsw26_adv -lwxmsw26_core -lwxbase26_xml -lwxbase26 -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lwxbase26_net -lwxmsw26_media
Creating library file: lib\gcc_dll\libwxmsw26_ifm.a
.objs\src\ifm\defplugin.o:defplugin.cpp:(.text+0x57db): undefined reference to `_imp___ZN11wxRectArrayC1ERKS_'
.objs\src\ifm\defplugin.o:defplugin.cpp:(.text+0x5a7a): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\defplugin.o:defplugin.cpp:(.text+0x5aaa): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\events.o:events.cpp:(.text+0x9ae): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\events.o:events.cpp:(.text+0x9c8): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'

.
.objs\src\ifm\events.o:events.cpp:(.text$_ZN19wxIFMCalcRectsEventD1Ev[wxIFMCalcRectsEvent::~wxIFMCalcRectsEvent()]+0x94): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\events.o:events.cpp:(.text$_ZN19wxIFMCalcRectsEventD1Ev[wxIFMCalcRectsEvent::~wxIFMCalcRectsEvent()]+0x151): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\events.o:events.cpp:(.text$_ZN19wxIFMCalcRectsEventD1Ev[wxIFMCalcRectsEvent::~wxIFMCalcRectsEvent()]+0x168): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\events.o:events.cpp:(.text$_ZN19wxIFMCalcRectsEventD1Ev[wxIFMCalcRectsEvent::~wxIFMCalcRectsEvent()]+0x17f):
.objs\src\ifm\events.o:events.cpp:(.text$_ZN19wxIFMCalcRectsEventD0Ev[wxIFMCalcRectsEvent::~wxIFMCalcRectsEvent()]+0x183): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x34d8): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x34f3): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x350e): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x3588): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x35a3): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x35be): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x3692): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x36b0): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x36ce): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x37b8): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x37d6): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\resize.o:resize.cpp:(.text+0x37f4): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x4499): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x44b7): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x44d5): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x4594): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x45af): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x45ca): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x46a8): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x46c3): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x46de): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x488e): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x48ac): undefined reference to `_imp___ZN11wxSizeArrayD1Ev'
.objs\src\ifm\definterface.o:definterface.cpp:(.text+0x48ca): undefined reference to `_imp___ZN11wxRectArrayD1Ev'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 25 seconds)
0 errors, 26 warnings

Post Reply