Dodle Posted December 18, 2008 Report Share Posted December 18, 2008 Hello, I am new to the forum, and pretty new to programming as well. I have been using wxWidgets with Python but recently wanted to learn C++. I am running Windows XP Pro. I am trying to compile the program from this page.I've installed wxWidgets and am using Mingw32 for my compiler. I'm having a lot of trouble. Here is the command I have been using to compile:c++ sample.cpp -o sampleI get the following error:wx/wx.h: No such file or directorywx/sizer.h: No such file or directoryI tried adding WXWIN environment variable with no effect. So I started telling the compiler where wxWidgets was installed:c++ sample.cpp -B C:/Env/wxMSW-2.8.9 -o sampleApparently with this the compiler found wxWidgets, but is still giving me errors. Too many errors to paste in here. Here is part of what prints out:C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN12wxAppConsole22SetInitializerFunctionEPFPS_vE[wxAppConsole::SetInitializerFunction(wxAppConsole* (*)())]+0x7): undefined reference to `wxAppConsole::ms_appInitFn'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN12wxWindowBase18SetInitialBestSizeERK6wxSize[wxWindowBase::SetInitialBestSize(wxSize const&)]+0x14): undefined reference to `wxWindowBase::SetInitialSize(wxSize const&)'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZNK12wxWindowBase20GetDefaultAttributesEv[wxWindowBase::GetDefaultAttributes() const]+0x1d): undefined reference to `wxWindowBase::GetClassDefaultAttributes(wxWindowVariant)'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZNK12wxWindowBase10HasCaptureEv[wxWindowBase::HasCapture() const]+0x7): undefined reference to `wxWindowBase::GetCapture()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN8wxObjectaSERKS_[wxObject::operator=(wxObject const&)]+0x1c): undefined reference to `wxObject::Ref(wxObject const&)'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN12wxStringBase4InitEv[wxStringBase::Init()]+0x7): undefined reference to `wxEmptyString'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN8wxStringaSERKS_[wxString::operator=(wxString const&)]+0x14): undefined reference to `wxStringBase::operator=(wxStringBase const&)'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN20wxThreadHelperThreadD1Ev[wxThreadHelperThread::~wxThreadHelperThread()]+0x16): undefined reference to `wxThread::~wxThread()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN20wxThreadHelperThreadD0Ev[wxThreadHelperThread::~wxThreadHelperThread()]+0x16): undefined reference to `wxThread::~wxThread()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN13BasicDrawPaneD1Ev[BasicDrawPane::~BasicDrawPane()]+0x16): undefined reference to `wxPanel::~wxPanel()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN13BasicDrawPaneD0Ev[BasicDrawPane::~BasicDrawPane()]+0x16): undefined reference to `wxPanel::~wxPanel()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN5MyAppD1Ev[MyApp::~MyApp()]+0x16): undefined reference to `wxApp::~wxApp()'C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN5MyAppD0Ev[MyApp::~MyApp()]+0x16): undefined reference to `wxApp::~wxApp()'collect2: ld returned 1 exit statusDoes anyone know what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted December 19, 2008 Report Share Posted December 19, 2008 I don't know either wxWidgets nor Mingw32. But what I can see is that you get lots of 'undefined reference' messages. Try to find in what header (.h) file these are defined, and see if adding an #include for that file improves things.Also I wonder if changing C:/Env/wxMSW-2.8.9 (in the c++ command) to C:\Env\wxMSW-2.8.9 would change anything? Quote Link to comment Share on other sites More sharing options...
Dodle Posted December 19, 2008 Author Report Share Posted December 19, 2008 Okay, I've started using Dev-C++ which allows me to define where my libraries are located. It seems to have fixed some things, but now I'm getting a bunch of Link Errors like the following: [Linker error] undefined reference to `wxFrameNameStr' Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted December 20, 2008 Report Share Posted December 20, 2008 Still, possible missing #include. Quote Link to comment Share on other sites More sharing options...
Dodle Posted December 26, 2008 Author Report Share Posted December 26, 2008 I moved setup.h into \include\wx, now I get the following errors. I have tried including different header files.In file included from C:/Env/wxMSW-2.8.9/include/wx/platform.h:196, from C:/Env/wxMSW-2.8.9/include/wx/defs.h:21, from C:/Env/wxMSW-2.8.9/include/wx/wx.h:15, from wx.cpp:6:C:/Env/wxMSW-2.8.9/include/wx/setup.h:247:6: #error "This file should only be included when using Microsoft Visual C++"In file included from C:/Env/wxMSW-2.8.9/include/wx/platform.h:293, from C:/Env/wxMSW-2.8.9/include/wx/defs.h:21, from C:/Env/wxMSW-2.8.9/include/wx/wx.h:15, from wx.cpp:6:C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:103:9: #error "wxUSE_DYNLIB_CLASS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:111:9: #error "wxUSE_EXCEPTIONS must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:119:9: #error "wxUSE_FILESYSTEM must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:127:9: #error "wxUSE_FS_ARCHIVE must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:140:9: #error "wxUSE_DYNAMIC_LOADER must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:148:9: #error "wxUSE_LOG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:156:9: #error "wxUSE_LONGLONG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:164:9: #error "wxUSE_MIMETYPE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:180:9: #error "wxUSE_PRINTF_POS_PARAMS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:188:9: #error "wxUSE_PROTOCOL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:230:9: #error "wxUSE_REGEX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:238:9: #error "wxUSE_STDPATHS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:246:9: #error "wxUSE_XML must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:254:9: #error "wxUSE_SOCKETS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:262:9: #error "wxUSE_STREAMS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:270:9: #error "wxUSE_STOPWATCH must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:278:9: #error "wxUSE_TEXTBUFFER must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:286:9: #error "wxUSE_TEXTFILE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:302:9: #error "wxUSE_URL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:310:9: #error "wxUSE_VARIANT must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:330:9: #error "wxUSE_ABOUTDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:338:9: #error "wxUSE_ACCEL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:346:9: #error "wxUSE_ANIMATIONCTRL mustbe defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:354:9: #error "wxUSE_BITMAPCOMBOBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:362:9: #error "wxUSE_BMPBUTTON must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:370:9: #error "wxUSE_BUTTON must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:378:9: #error "wxUSE_CALENDARCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:386:9: #error "wxUSE_CARET must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:394:9: #error "wxUSE_CHECKBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:410:9: #error "wxUSE_CHOICE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:418:9: #error "wxUSE_CHOICEBOOK must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:426:9: #error "wxUSE_CHOICEDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:434:9: #error "wxUSE_CLIPBOARD must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:442:9: #error "wxUSE_COLLPANE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:450:9: #error "wxUSE_COLOURDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:458:9: #error "wxUSE_COLOURPICKERCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:466:9: #error "wxUSE_COMBOBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:474:9: #error "wxUSE_COMBOCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:482:9: #error "wxUSE_DATAOBJ must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:490:9: #error "wxUSE_DATAVIEWCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:498:9: #error "wxUSE_DATEPICKCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:506:9: #error "wxUSE_DIRPICKERCTRL mustbe defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:514:9: #error "wxUSE_DISPLAY must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:522:9: #error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:530:9: #error "wxUSE_FILEDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:538:9: #error "wxUSE_FILEPICKERCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:546:9: #error "wxUSE_FONTDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:554:9: #error "wxUSE_FONTMAP must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:562:9: #error "wxUSE_FONTPICKERCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:570:9: #error "wxUSE_GAUGE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:578:9: #error "wxUSE_GRAPHICS_CONTEXT must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:587:9: #error "wxUSE_GRID must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:595:9: #error "wxUSE_HELP must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:603:9: #error "wxUSE_HYPERLINKCTRL mustbe defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:611:9: #error "wxUSE_HTML must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:632:9: #error "wxUSE_ICO_CUR must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:640:9: #error "wxUSE_IFF must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:648:9: #error "wxUSE_IMAGLIST must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:656:9: #error "wxUSE_JOYSTICK must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:664:9: #error "wxUSE_LISTBOOK must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:672:9: #error "wxUSE_LISTBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:680:9: #error "wxUSE_LISTCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:688:9: #error "wxUSE_LOGGUI must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:696:9: #error "wxUSE_LOGWINDOW must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:704:9: #error "wxUSE_LOG_DIALOG must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:712:9: #error "wxUSE_MDI must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:720:9: #error "wxUSE_MDI_ARCHITECTURE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:728:9: #error "wxUSE_MENUS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:736:9: #error "wxUSE_MSGDLG must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:744:9: #error "wxUSE_NOTEBOOK must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:752:9: #error "wxUSE_ODCOMBOBOX must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:760:9: #error "wxUSE_PALETTE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:768:9: #error "wxUSE_POPUPWIN must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:776:9: #error "wxUSE_PRINTING_ARCHITECTURE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:784:9: #error "wxUSE_RADIOBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:792:9: #error "wxUSE_RADIOBTN must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:800:9: #error "wxUSE_SASH must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:808:9: #error "wxUSE_SCROLLBAR must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:816:9: #error "wxUSE_SLIDER must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:824:9: #error "wxUSE_SOUND must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:832:9: #error "wxUSE_SPINBTN must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:840:9: #error "wxUSE_SPINCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:848:9: #error "wxUSE_SPLASH must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:856:9: #error "wxUSE_SPLITTER must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:864:9: #error "wxUSE_STATBMP must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:872:9: #error "wxUSE_STATBOX must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:880:9: #error "wxUSE_STATLINE must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:888:9: #error "wxUSE_STATTEXT must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:896:9: #error "wxUSE_STATUSBAR must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:904:9: #error "wxUSE_TAB_DIALOG must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:912:9: #error "wxUSE_TEXTCTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:920:9: #error "wxUSE_TIPWINDOW must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:928:9: #error "wxUSE_TOOLBAR must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:936:9: #error "wxUSE_TOOLTIPS must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:944:9: #error "wxUSE_TREECTRL must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:952:9: #error "wxUSE_VALIDATORS must bedefined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:960:9: #error "wxUSE_WXHTML_HELP must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:968:9: #error "wxUSE_XRC must be defined."C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:1765:9: #error "wxMessageBox is always needed"In file included from C:/Env/wxMSW-2.8.9/include/wx/region.h:222, from C:/Env/wxMSW-2.8.9/include/wx/window.h:26, from C:/Env/wxMSW-2.8.9/include/wx/wx.h:36, from wx.cpp:6:C:/Env/wxMSW-2.8.9/include/wx/msw/region.h: In constructor `wxRegion::wxRegion(const wxBitmap&, const wxColour&, int)':C:/Env/wxMSW-2.8.9/include/wx/msw/region.h:31: error: no matching function for call to `wxRegion::Union(const wxBitmap&, const wxColour&, int&)'C:/Env/wxMSW-2.8.9/include/wx/region.h:128: note: candidates are: bool wxRegionBase::Union(wxCoord, wxCoord, wxCoord, wxCoord)C:/Env/wxMSW-2.8.9/include/wx/region.h:130: note: bool wxRegionBase::Union(const wxRect&)C:/Env/wxMSW-2.8.9/include/wx/region.h:132: note: bool wxRegionBase::Union(const wxRegion&)wx.cpp: In constructor `MyFrame::MyFrame(const wxString&, const wxPoint&, constwxSize&)':wx.cpp:49: error: invalid use of undefined type `struct wxMenu'C:/Env/wxMSW-2.8.9/include/wx/event.h:37: error: forward declaration of `structwxMenu'wx.cpp:51: error: invalid use of undefined type `struct wxMenu'C:/Env/wxMSW-2.8.9/include/wx/event.h:37: error: forward declaration of `structwxMenu'wx.cpp:52: error: invalid use of undefined type `struct wxMenu'C:/Env/wxMSW-2.8.9/include/wx/event.h:37: error: forward declaration of `structwxMenu'wx.cpp:53: error: invalid use of undefined type `struct wxMenu'C:/Env/wxMSW-2.8.9/include/wx/event.h:37: error: forward declaration of `structwxMenu'wx.cpp:55: error: invalid use of undefined type `struct wxMenuBar'C:/Env/wxMSW-2.8.9/include/wx/frame.h:26: error: forward declaration of `structwxMenuBar'wx.cpp:56: error: invalid use of undefined type `struct wxMenuBar'C:/Env/wxMSW-2.8.9/include/wx/frame.h:26: error: forward declaration of `structwxMenuBar'wx.cpp:58: error: `SetMenuBar' was not declared in this scopewx.cpp:60: error: `CreateStatusBar' was not declared in this scopewx.cpp:61: error: `SetStatusText' was not declared in this scopewx.cpp: In member function `void MyFrame::OnAbout(wxCommandEvent&)':wx.cpp:72: error: `wxMessageBox' was not declared in this scope Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted December 27, 2008 Report Share Posted December 27, 2008 You have to place the #include statements in the right order, e.g. the one containing the missing definitions before chkconf.h Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.