Author Topic: Why I hate wxWidgets...  (Read 3427 times)

0 Members and 1 Guest are viewing this topic.

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Why I hate wxWidgets...
Command line: gcc helloworld.cpp -I "/usr/lib/wx/include/base-2.4/"

Error output: http://fs2source.warpcore.org/out.txt

Program source:
Code: [Select]
//Stupid wx
#include "wx/wxprec.h"

//wtf?
#ifdef __BORLANDC__
#pragma hdrstop
#endif

//all this crap should be in wxprec.h
#ifndef WX_PRECOMP
 #include "wx/wx.h"
#endif

class MyApp: public wxApp
{
virtual bool OnInit();
};

class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);

DECLARE_EVENT_TABLE()
};

enum
{
ID_Quit = 1,
ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame("Hello World", wxPoint(50,50), wxSize(450,340));
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;

menuFile->Append(ID_About, "&About...");
menuFile->AppendSeparator();
menuFile->Append(ID_Quit, "E&xit");

wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");

SetMenuBar(menuBar);

CreateStatusBar();
SetStatusText("Welcome to wxWidgets!");
}

void MyFrame::OnQuit(wxCommandEvent& WX_UNUSED(event))
{
Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox("This is a wxWidget's Hello world sample", "About Hello World", wxOK | wxICON_INFORMATION);
}
-C

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Why I hate wxWidgets...
You need to be doing this: "gcc -o helloworld helloworld.cpp `wx-config --cflags --libs`"

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Why I hate wxWidgets...
Awesomeness :yes: Thanks taylor. Works fine now.

Hopefully my second go at this will be better than the first...
-C

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Why I hate wxWidgets...
Actually, I suppose this is as good a place as any to ask, but would you foresee any problems if I upgraded to gcc 4.0? Fs2_open is pretty much the only thing I compile on Linux; if I can help it, I grab programs from the .deb repos.
-C

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Why I hate wxWidgets...
I already upgraded it for GCC4 so it should compile FS2_Open fine.

And depending on how the packages are set up it should be possible to have GCC4 and a GCC3 compiler installed at the same time.  With Fedora Core 4 I have GCC4 and GCC 3.2 installed so if a program doesn't compile in 4 then I can easily compile it with 3.2 instead.  It's just a matter of using gcc32 (or g++32) over the normal gcc (g++) commands.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Why I hate wxWidgets...
Hmm, well, getting my old libs copied over is turning out to be a bit of a pain. First the source computer bluescreens, then gTFP crashes, then the source computer bluescreens again. :p :wtf:
-C