Jump to content

Can't get wxWidgets to work


Recommended Posts

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 sample

I get the following error:

wx/wx.h: No such file or directory
wx/sizer.h: No such file or directory

I 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 sample

Apparently 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$_ZN12wxAppConsole2
2SetInitializerFunctionEPFPS_vE[wxAppConsole::SetInitializerFunction(wxAppConsol
e* (*)())]+0x7): undefined reference to `wxAppConsole::ms_appInitFn'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN12wxWindowBase1
8SetInitialBestSizeERK6wxSize[wxWindowBase::SetInitialBestSize(wxSize const&)]+0
x14): undefined reference to `wxWindowBase::SetInitialSize(wxSize const&)'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZNK12wxWindowBase
20GetDefaultAttributesEv[wxWindowBase::GetDefaultAttributes() const]+0x1d): unde
fined reference to `wxWindowBase::GetClassDefaultAttributes(wxWindowVariant)'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZNK12wxWindowBase
10HasCaptureEv[wxWindowBase::HasCapture() const]+0x7): undefined reference to `w
xWindowBase::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$_ZN12wxStringBase4
InitEv[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 `wxStringB
ase::operator=(wxStringBase const&)'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN20wxThreadHelpe
rThreadD1Ev[wxThreadHelperThread::~wxThreadHelperThread()]+0x16): undefined refe
rence to `wxThread::~wxThread()'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN20wxThreadHelpe
rThreadD0Ev[wxThreadHelperThread::~wxThreadHelperThread()]+0x16): undefined refe
rence to `wxThread::~wxThread()'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN13BasicDrawPane
D1Ev[BasicDrawPane::~BasicDrawPane()]+0x16): undefined reference to `wxPanel::~w
xPanel()'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN13BasicDrawPane
D0Ev[BasicDrawPane::~BasicDrawPane()]+0x16): undefined reference to `wxPanel::~w
xPanel()'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN5MyAppD1Ev[MyAp
p::~MyApp()]+0x16): undefined reference to `wxApp::~wxApp()'
C:\DOCUME~1\Jordan\LOCALS~1\Temp/ccqUKUd3.o:sample.cpp:(.text$_ZN5MyAppD0Ev[MyAp
p::~MyApp()]+0x16): undefined reference to `wxApp::~wxApp()'
collect2: ld returned 1 exit status

Does anyone know what I am doing wrong?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 in
cluded 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 b
e defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:111:9: #error "wxUSE_EXCEPTIONS must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:119:9: #error "wxUSE_FILESYSTEM must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:127:9: #error "wxUSE_FS_ARCHIVE must be
defined."
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 de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:164:9: #error "wxUSE_MIMETYPE must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:180:9: #error "wxUSE_PRINTF_POS_PARAMS m
ust be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:188:9: #error "wxUSE_PROTOCOL must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:230:9: #error "wxUSE_REGEX must be defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:238:9: #error "wxUSE_STDPATHS must be de
fined."
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 def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:262:9: #error "wxUSE_STREAMS must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:270:9: #error "wxUSE_STOPWATCH must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:278:9: #error "wxUSE_TEXTBUFFER must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:286:9: #error "wxUSE_TEXTFILE must be de
fined."
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 def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:330:9: #error "wxUSE_ABOUTDLG must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:338:9: #error "wxUSE_ACCEL must be defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:346:9: #error "wxUSE_ANIMATIONCTRL must
be 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 d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:370:9: #error "wxUSE_BUTTON must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:378:9: #error "wxUSE_CALENDARCTRL must b
e defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:386:9: #error "wxUSE_CARET must be defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:394:9: #error "wxUSE_CHECKBOX must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:410:9: #error "wxUSE_CHOICE must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:418:9: #error "wxUSE_CHOICEBOOK must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:426:9: #error "wxUSE_CHOICEDLG must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:434:9: #error "wxUSE_CLIPBOARD must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:442:9: #error "wxUSE_COLLPANE must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:450:9: #error "wxUSE_COLOURDLG must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:458:9: #error "wxUSE_COLOURPICKERCTRL mu
st be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:466:9: #error "wxUSE_COMBOBOX must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:474:9: #error "wxUSE_COMBOCTRL must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:482:9: #error "wxUSE_DATAOBJ must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:490:9: #error "wxUSE_DATAVIEWCTRL must b
e defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:498:9: #error "wxUSE_DATEPICKCTRL must b
e defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:506:9: #error "wxUSE_DIRPICKERCTRL must
be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:514:9: #error "wxUSE_DISPLAY must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:522:9: #error "wxUSE_DOC_VIEW_ARCHITECTU
RE must be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:530:9: #error "wxUSE_FILEDLG must be def
ined."
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 def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:554:9: #error "wxUSE_FONTMAP must be def
ined."
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 defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:578:9: #error "wxUSE_GRAPHICS_CONTEXT mu
st be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:587:9: #error "wxUSE_GRID must be define
d."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:595:9: #error "wxUSE_HELP must be define
d."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:603:9: #error "wxUSE_HYPERLINKCTRL must
be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:611:9: #error "wxUSE_HTML must be define
d."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:632:9: #error "wxUSE_ICO_CUR must be def
ined."
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 de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:656:9: #error "wxUSE_JOYSTICK must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:664:9: #error "wxUSE_LISTBOOK must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:672:9: #error "wxUSE_LISTBOX must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:680:9: #error "wxUSE_LISTCTRL must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:688:9: #error "wxUSE_LOGGUI must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:696:9: #error "wxUSE_LOGWINDOW must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:704:9: #error "wxUSE_LOG_DIALOG must be
defined."
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 mu
st be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:728:9: #error "wxUSE_MENUS must be defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:736:9: #error "wxUSE_MSGDLG must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:744:9: #error "wxUSE_NOTEBOOK must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:752:9: #error "wxUSE_ODCOMBOBOX must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:760:9: #error "wxUSE_PALETTE must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:768:9: #error "wxUSE_POPUPWIN must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:776:9: #error "wxUSE_PRINTING_ARCHITECTU
RE must be defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:784:9: #error "wxUSE_RADIOBOX must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:792:9: #error "wxUSE_RADIOBTN must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:800:9: #error "wxUSE_SASH must be define
d."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:808:9: #error "wxUSE_SCROLLBAR must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:816:9: #error "wxUSE_SLIDER must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:824:9: #error "wxUSE_SOUND must be defin
ed."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:832:9: #error "wxUSE_SPINBTN must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:840:9: #error "wxUSE_SPINCTRL must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:848:9: #error "wxUSE_SPLASH must be defi
ned."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:856:9: #error "wxUSE_SPLITTER must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:864:9: #error "wxUSE_STATBMP must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:872:9: #error "wxUSE_STATBOX must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:880:9: #error "wxUSE_STATLINE must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:888:9: #error "wxUSE_STATTEXT must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:896:9: #error "wxUSE_STATUSBAR must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:904:9: #error "wxUSE_TAB_DIALOG must be
defined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:912:9: #error "wxUSE_TEXTCTRL must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:920:9: #error "wxUSE_TIPWINDOW must be d
efined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:928:9: #error "wxUSE_TOOLBAR must be def
ined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:936:9: #error "wxUSE_TOOLTIPS must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:944:9: #error "wxUSE_TREECTRL must be de
fined."
C:/Env/wxMSW-2.8.9/include/wx/chkconf.h:952:9: #error "wxUSE_VALIDATORS must be
defined."
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 n
eeded"
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(c
onst wxBitmap&, const wxColour&, int)':
C:/Env/wxMSW-2.8.9/include/wx/msw/region.h:31: error: no matching function for c
all to `wxRegion::Union(const wxBitmap&, const wxColour&, int&)'
C:/Env/wxMSW-2.8.9/include/wx/region.h:128: note: candidates are: bool wxRegionB
ase::Union(wxCoord, wxCoord, wxCoord, wxCoord)
C:/Env/wxMSW-2.8.9/include/wx/region.h:130: note: bool wxRegionB
ase::Union(const wxRect&)
C:/Env/wxMSW-2.8.9/include/wx/region.h:132: note: bool wxRegionB
ase::Union(const wxRegion&)
wx.cpp: In constructor `MyFrame::MyFrame(const wxString&, const wxPoint&, const
wxSize&)':
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 `struct
wxMenu'
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 `struct
wxMenu'
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 `struct
wxMenu'
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 `struct
wxMenu'
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 `struct
wxMenuBar'
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 `struct
wxMenuBar'
wx.cpp:58: error: `SetMenuBar' was not declared in this scope
wx.cpp:60: error: `CreateStatusBar' was not declared in this scope
wx.cpp:61: error: `SetStatusText' was not declared in this scope
wx.cpp: In member function `void MyFrame::OnAbout(wxCommandEvent&)':
wx.cpp:72: error: `wxMessageBox' was not declared in this scope

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy