RE: Fruit basket program in C++ with WxWidgets

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 1 Dec 2007 12:59:13 -0800


Well I don't know that you can use MFC with Mingw or Borland with out using
the dll version so it wouldn't exactly be stand alone but let me get the
minimal version of this in MFC to start it off with and then go from there. 

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
Sent: Saturday, December 01, 2007 12:21 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: Fruit basket program in C++ with WxWidgets

I mean VC++ Express, MinGW, and/or Borland C++ Builder samples.
Ideally, I'm interested in comparing self-standing executables created by
these free C++ compilers.  Anything you can do toward this end with a
minimalist fruit basket program is appreciated.
Jamal
On Sat, 1 Dec 2007, Ken
Perry wrote:

> Date: Sat, 1 Dec 2007 11:57:43 -0800
> From: Ken Perry <whistler@xxxxxxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Fruit basket program in C++ with WxWidgets
>
>
>
> Actually I got side tracked. and again now with WX widgets I got side 
> tracked.  I will go back to the mfc project and finish it before I 
> jump into the WX widget one that way if the other person that 
> responded to you finishes first great.  When you say free compiler do you
mean VC++ express?
> I don't know that I can do that easily but I will give it a shot I can 
> put express on my laptop I just don't want to screw up my VS install 
> on this computer.
>
> Ken
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal 
> Mazrui
> Sent: Saturday, December 01, 2007 11:39 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Fruit basket program in C++ with WxWidgets
>
> Thanks for trying to help with this, Ken.  Make sure you compile with 
> the standard rather than "universal" Wx Widgets libraries.  The latter 
> are custom rather than native controls (with MSAA).
>
> Regarding MFC, have you been able to compile a single-file version of 
> your fruit basket program?  If so, can you possibly include 
> instructions for using a free command-line compiler to build the program?
>
> Jamal
> On Sat, 1 Dec
> 2007, Ken Perry wrote:
>
> > Date: Sat, 1 Dec 2007 10:27:41 -0800
> > From: Ken Perry <whistler@xxxxxxxxxxxxx>
> > Reply-To: programmingblind@xxxxxxxxxxxxx
> > To: programmingblind@xxxxxxxxxxxxx
> > Subject: RE: Fruit basket program in C++ with WxWidgets
> >
> >
> >
> > I would do it but when I last downloaded WX it was not that 
> > accessible after making the application so I deleted it from my 
> > computer.  It was not hard to create the application but it was not 
> > that much easier than just using MFC so that was another reason for 
> > just deleting the WX widgets.  I will go see if its worth while now.
> >
> > Ken
> >
> >
> > -----Original Message-----
> > From: programmingblind-bounce@xxxxxxxxxxxxx
> > [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal 
> > Mazrui
> > Sent: Saturday, December 01, 2007 9:58 AM
> > To: programmingblind@xxxxxxxxxxxxx
> > Subject: Re: Fruit basket program in C++ with WxWidgets
> >
> > Since you said it was coming soon, I've been waiting for a tutorial 
> > on compiling a C++/Wx application (as opposed to the Wx libraries) ....
> > <grin>  The lack of response so far on this question from any C++ 
> > developer on the list leads me to infer that the process is more 
> > complex than I anticipated, even when one already knows the C++ 
> > language.  If someone posted a question about how to build a .NET
> executable with a
> > 3rd party assembly, I could have quickly answered with specifics.   This
> > is not intended as a criticism of anyone and their schedules -- just 
> > an observation of C++ development that is being personally 
> > substantiated for me.
> >
> > Jamal
> > On Sat, 1 Dec 2007, jaffar wrote:
> >
> > > Date: Sat, 1 Dec 2007 22:09:24 +0800
> > > From: jaffar <jaffar@xxxxxxxxxxxxx>
> > > Reply-To: programmingblind@xxxxxxxxxxxxx
> > > To: programmingblind@xxxxxxxxxxxxx
> > > Subject: Re: Fruit basket program in C++ with WxWidgets
> > >
> > > Hi Jamal.  I'll compile it on monday or tuesday as I have a family 
> > > event during the week end and unfortunately cannot spare the time.
> > > I'll do it during lunch time in my office.  Cheers!
> > > ----- Original Message -----
> > > From: "Jamal Mazrui" <empower@xxxxxxxxx>
> > > To: <programmingblind@xxxxxxxxxxxxx>
> > > Sent: Friday, November 30, 2007 11:57 PM
> > > Subject: Re: Fruit basket program in C++ with WxWidgets
> > >
> > >
> > > As far as I can tell, the call to the VC++ compiler does not 
> > > include the /clr parameter, so there should not be a .NET 
> > > dependency.  Also, since I think Octavian has .NET installed, the 
> > > program should be able to find the .NET dependency if that were 
> > > true, especially if the .manifest file is in the same directory.  
> > > I suspect (though am not
> > > sure) that the dependency is on a file in the Windows platform SDK 
> > > that I installed, and perhaps Octavian did not.
> > >
> > >   If you are referring to another , earlier message thread in 
> > > which Will posted about this problem, I could not find it via Google.
> > >
> > > Marlon, what C++ compilers do you use?  Do you use any free ones 
> > > or know how to use them?  Can you help me compile the Wx source 
> > > code with MinGW or Borland C++ Builder so that it is a single, 
> > > self-standing executable (whatever the size)?  The complete source 
> > > code is in the cwx_fruit.cpp file within the archive at 
> > > http://www.EmpowermentZone.com/cwx_fruit.zip
> > >
> > > Jamal
> > > On Fri, 30 Nov 2007, Marlon
> > > Brandão de Sousa wrote:
> > >
> > > > Date: Fri, 30 Nov 2007 12:52:12 -0200
> > > > From: Marlon Brandão de Sousa <splyt.lists@xxxxxxxxx>
> > > > Reply-To: programmingblind@xxxxxxxxxxxxx
> > > > To: programmingblind@xxxxxxxxxxxxx
> > > > Subject: Re: Fruit basket program in C++ with WxWidgets
> > > >
> > > > I think it isn't a .net dependency. Vc .net 2005 uses a kind of 
> > > > manifest to link to the right version of the C crt, a kind of 
> > > > (personal thought here) ridiculous thing ms did to try to avoid 
> > > > dll hell ... and you have to embed this manifest in your 
> > > > executable or redistribute it with your software. I don't know 
> > > > how to do it, but Will Pearson talked about this some time ago 
> > > > in this
> list.
> > > > Marlon
> > > >
> > > > 2007/11/30, Jamal Mazrui <empower@xxxxxxxxx>:
> > > > > Jaffar or other C++ developers, Apparently, the Win32 
> > > > > executable I built has dependencies that I do not intend.  Can 
> > > > > you help me build a version as a single, self-standing 
> > > > > executable, preferrably with the same VC++ compiler?
> > > > > Doing so with any other free C++ compiler would also be of
interest.
> > > > >
> > > > > Jamal
> > > > > On Thu, 29 Nov 2007,
> > > > > Octavian Rasnita wrote:
> > > > >
> > > > > > Date: Thu, 29 Nov 2007 08:03:22 +0200
> > > > > > From: Octavian Rasnita <orasnita@xxxxxxxxx>
> > > > > > Reply-To: programmingblind@xxxxxxxxxxxxx
> > > > > > To: programmingblind@xxxxxxxxxxxxx
> > > > > > Subject: Re: Fruit basket program in C++ with WxWidgets
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have tried to run the executable, but the following error
> > appeared:
> > > > > >
> > > > > > This application has failed to start because the application 
> > > > > > configuration is incorrect. Reinstalling the application may 
> > > > > > fix this problem.
> > > > > > OK
> > > > > >
> > > > > > Does anyone know in what programming language and with which 
> > > > > > GUI library
> > > > > is
> > > > > > made the program UTorrent?
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > Octavian
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "Jamal Mazrui" <empower@xxxxxxxxx>
> > > > > > To: <programmingblind@xxxxxxxxxxxxx>
> > > > > > Sent: Wednesday, November 28, 2007 9:04 PM
> > > > > > Subject: Fruit basket program in C++ with WxWidgets
> > > > > >
> > > > > >
> > > > > > > From the archive at
> > > > > > > http://www.EmpowermentZone.com/cwx_fruit.zip
> > > > > > >
> > > > > > > This fruit basket program is written in C++, using the 
> > > > > > > open source WxWidgets GUI library and application 
> > > > > > > framework available from http://WxWidgets.org
> > > > > > >
> > > > > > > The program is compiled with the free Microsoft Visual C++ 
> > > > > > > Express Edition, available from http://msdn.microsoft.com 
> > > > > > > Another download needed from there is the Windows Platform
SDK.
> > > > > > >
> > > > > > > This is my first nontrivial program in C++, so I encourage 
> > > > > > > others to suggest improvements to the code.  I am also 
> > > > > > > interested in comparing binaries produced by other free 
> > > > > > > C++ compilers, including MinGW and
> > > > > Borland
> > > > > > > C++ Builder, which should be able to compile the same code 
> > > > > > > C++ if
> > > > > > > properly
> > > > > > > configured for Wx application development.
> > > > > > >
> > > > > > > To aid comprehension, I have tried to make the code 
> > > > > > > minimalist in
> > > > > nature.
> > > > > > > It is contained in a single file, cwx_fruit.cpp (also 
> > > > > > > pasted below),
> > > > > with
> > > > > > > no custom include or resource files.  I have not yet 
> > > > > > > learned how to compile a Wx program by writing a make file 
> > > > > > > or configuring Visual
> > > > > Studio,
> > > > > > > but was able to use the make file that comes with the
"Minimal"
> > > > > > > sample
> > > > > > > program in the Wx distribution.  I simply replaced the 
> > > > > > > minimal.cpp file with the content of cwx_fruit.cpp, and 
> > > > > > > then renamed the resulting executable from minimal.exe to 
> > > > > > > cwx_fruit.exe.
> > > > > > >
> > > > > > > With Unicode and release compilation options, that 
> > > > > > > executable was about
> > > > > > > 1.1 MB in size.  I reduced it by two thirds -- to about 
> > > > > > > 373KB
> > > > > > > -- using
> > > > > the
> > > > > > > free "Ultimate Packer for Executables" utility available 
> > > > > > > from http://upx.sourceforge.net
> > > > > > >
> > > > > > > Besides the executable, a manifest file, under 1KB in 
> > > > > > > size, is currently needed in the same directory in order 
> > > > > > > to run the program.  A .NET Framework dependency might 
> > > > > > > also exist, since this C++ compiler can
> > > > > produce
> > > > > > > executables with such a dependency if proper parameters 
> > > > > > > were not used (I have not understood the make file enough to
know).
> > > > > > > I would appreciate assistance in eliminating the need for 
> > > > > > > a seperate cwx_fruit.exe.manifest file, as well as 
> > > > > > > ensuring that no .NET dependency exists.  I think this 
> > > > > > > compiler is capable of producing a self-standing Win32 
> > > > > > > executable,
> > > > > though
> > > > > > > the file size may increase.
> > > > > > >
> > > > > > > Jamal
> > > > > > >
> > > > > > > /*
> > > > > > > Content of cwx_fruit.cpp
> > > > > > > Fruit basket program in C++ with WxWidgets 2.8 Compiled 
> > > > > > > with Microsoft Visual C++ 2005 Express Public domain by 
> > > > > > > Jamal Mazrui */
> > > > > > >
> > > > > > > // Import headers
> > > > > > > #include "wx/wx.h"
> > > > > > >
> > > > > > > // Derive custom dialog class class FbDialog : public 
> > > > > > > wxDialog {
> > > > > > >
> > > > > > > public:
> > > > > > > // Declare control variables wxTextCtrl *txtFruit; 
> > > > > > > wxListBox *lstBasket; wxButton *btnAdd, *btnDelete;
> > > > > > >
> > > > > > > // Define add event handler void OnAdd(wxCommandEvent& 
> > > > > > > WXUNUSED(event)) { wxString sValue = txtFruit->GetValue(); 
> > > > > > > if (sValue == wxEmptyString) { wxMessageBox(wxT("No fruit 
> > > > > > > to add!"), wxT("Alert")); } else {
> > > > > > > lstBasket->Append(sValue);
> > > > > > > txtFruit->Clear();
> > > > > > > int iFruit = lstBasket->GetCount() - 1;
> > > > > > > lstBasket->SetSelection(iFruit);
> > > > > > > }
> > > > > > > } // OnAdd event handler
> > > > > > >
> > > > > > > // Define delete event handler void 
> > > > > > > OnDelete(wxCommandEvent&
> > > > > > > WXUNUSED(event)) { int iFruit = lstBasket->GetSelection(); 
> > > > > > > if (iFruit == -1) { wxMessageBox(wxT("No fruit to 
> > > > > > > delete!"), wxT("Alert")); } else {
> > > > > > > lstBasket->Delete(iFruit);
> > > > > > > if (iFruit == lstBasket->GetCount()) {iFruit--;}
> > > > > > > lstBasket->SetSelection(iFruit);
> > > > > > > }
> > > > > > > } // OnDelete event handler
> > > > > > >
> > > > > > > // Define close event handler void OnClose(wxCloseEvent&
> > > > > > > event) { if (wxMessageBox(wxT("Exit program?"), 
> > > > > > > wxT("Confirm"), wxYES_NO |
> > > > > > > wxCANCEL) == wxYES) {
> > > > > > > Destroy();
> > > > > > > event.Skip();
> > > > > > > }
> > > > > > > else {
> > > > > > > event.Veto();
> > > > > > > }
> > > > > > > } // OnClose event handler
> > > > > > >
> > > > > > > // Define dialog constructor
> > > > > > > //FbDialog::FbDialog() : wxDialog(NULL, wxID_ANY, 
> > > > > > > wxT("Fruit Basket"), wxDefaultPosition, wxSize(513, 176)) 
> > > > > > > {
> > > > > > > FbDialog() : wxDialog(NULL, wxID_ANY, wxT("Fruit Basket"), 
> > > > > > > wxDefaultPosition, wxSize(513, 176)) { new 
> > > > > > > wxStaticText(this, wxID_ANY, wxT("&Fruit:"), wxPoint(14, 
> > > > > > > 14), wxDefaultSize); txtFruit = new wxTextCtrl(this, 
> > > > > > > wxID_ANY, wxEmptyString, wxPoint(43,
> > > > > 14),
> > > > > > > wxDefaultSize, wxTE_LEFT);
> > > > > > >
> > > > > > > new wxStaticText(this, wxID_ANY, wxT("&Basket:"), 
> > > > > > > wxPoint(251, 14), wxDefaultSize); lstBasket = new 
> > > > > > > wxListBox(this, wxID_ANY, wxPoint(293,14),
> > > > > wxDefaultSize,
> > > > > > > 0);
> > > > > > >
> > > > > > > btnAdd = new wxButton(this, wxID_ANY, wxT("&Add"), 
> > > > > > > wxPoint(190, 121), wxDefaultSize);
> > > > > > > btnAdd->SetDefault();
> > > > > > > Connect(btnAdd->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, 
> > > > > > > wxCommandEventHandler(FbDialog::OnAdd));
> > > > > > >
> > > > > > > btnDelete = new wxButton(this, wxID_ANY, wxT("&Delete"), 
> > > > > > > wxPoint(217, 121), wxDefaultSize); 
> > > > > > > Connect(btnDelete->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, 
> > > > > > > wxCommandEventHandler(FbDialog::OnDelete));
> > > > > > >
> > > > > > > Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, 
> > > > > > > wxCloseEventHandler(FbDialog::OnClose));
> > > > > > >
> > > > > > > Centre();
> > > > > > > ShowModal();
> > > > > > > } // FbDialog constructor
> > > > > > >
> > > > > > > }; // FbDialog class
> > > > > > >
> > > > > > > // Derive custom application class class FbApp : public 
> > > > > > > wxApp {
> > > > > > >
> > > > > > > public:
> > > > > > > bool OnInit() {
> > > > > > > new FbDialog();
> > > > > > > return true;
> > > > > > > } // Init method
> > > > > > >
> > > > > > > }; // FbApp class
> > > > > > >
> > > > > > > // Define main entry point via compiler macro
> > > > > > > IMPLEMENT_APP(FbApp)
> > > > > > >
> > > > > > > // End of cwx_fruit.cpp
> > > > > > >
> > > > > > > __________
> > > > > > > View the list's information and change your settings at 
> > > > > > > //www.freelists.org/list/programmingblind
> > > > > > >
> > > > > >
> > > > > > __________
> > > > > > View the list's information and change your settings at 
> > > > > > //www.freelists.org/list/programmingblind
> > > > > >
> > > > > __________
> > > > > View the list's information and change your settings at 
> > > > > //www.freelists.org/list/programmingblind
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > When you say "I wrote a program that crashed Windows," people 
> > > > just stare at you blankly and say "Hey, I got those with the 
> > > > system, for free."
> > > > Linus Torvalds
> > > > __________
> > > > View the list's information and change your settings at 
> > > > //www.freelists.org/list/programmingblind
> > > >
> > > __________
> > > View the list's information and change your settings at 
> > > //www.freelists.org/list/programmingblind
> > >
> > > __________
> > > View the list's information and change your settings at 
> > > //www.freelists.org/list/programmingblind
> > >
> > __________
> > View the list's information and change your settings at 
> > //www.freelists.org/list/programmingblind
> >
> > __________
> > View the list's information and change your settings at 
> > //www.freelists.org/list/programmingblind
> >
> __________
> View the list's information and change your settings at 
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at 
> //www.freelists.org/list/programmingblind
>
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: