Re: Fruit basket program in C++ with WxWidgets

  • From: "jaffar" <jaffar@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 1 Dec 2007 22:09:24 +0800

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

Other related posts: