64,654
社区成员
发帖
与我相关
我的任务
分享
#makefile for MinGW Hello World Test
OBJ_LIST=$(subst .cpp,.o,$(wildcard *.cpp))
wxInclude=D:\wxWidgets-2.8.12\include \
D:\wxWidgets-2.8.12\build\msw\gcc_mswu \
D:\wxWidgets-2.8.12\contrib\include
wxLib=D:\wxWidgets-2.8.12\lib
CC=g++
AR=ar
LD=ld
RM=del
#RM=rm -rf
MV=MOVE /Y
CP=copy
C++FLAGS = -g -enable-auto-import \
-Wno-deprecated \
-Wall -Werror \
-I $(wxInclude) \
-L $(wxLib)
TARGET = minimal.exe
all: depend.dep $(TARGET)
$(TARGET): $(OBJ_LIST)
$(CC) -o $(TARGET) $(OBJ_LIST) -mwindows
# $(TARGET)
clean:
$(RM) *.o *.obj *.tmp *.exe *.dep *.s
depend.dep:
$(CC) -M $(C++FLAGS) $(wildcard *.cpp)> $@
-include depend.*
.cpp.o:
$(CXX) -c $(C++FLAGS) $<
%.dir:%
$(MAKE) -C $< $(DEBUG_MAKE)
//name: minimal.cpp
//purpose Minimal wx sample
#include "wx/wx.h"
class MyApp:public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame:public wxFrame
{
public:
MyFrame(const wxString& title);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE()
};
DECLARE_APP(MyApp)
//(*AppHeaders
#include <wx/image.h>
//*)
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
//(*AppInitialize
bool wxsOK = true;
wxInitAllImageHandlers();
//*)
return wxsOK;
MyFrame *frame=new MyFrame(wxT("Minimal wxWidgets App"));
frame->Show(true);
return true;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
END_EVENT_TABLE()
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxString msg;
msg.Printf(wxT("Hello and welcome to %s"), wxVERSION_STRING);
wxMessageBox(msg, wxT("About_Minimal"), wxOK|wxICON_INFORMATION, this);
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
#include "mondrian.xpm"
MyFrame::MyFrame(const wxString& title):wxFrame(NULL, wxID_ANY, title)
{
SetIcon(wxIcon(mondrian_xpm));
wxMenu *fileMenu=new wxMenu;
wxMenu *helpMenu=new wxMenu;
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"), wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("E&xit...\tAlt-X"), wxT("Quit this program"));
wxMenuBar *menuBar=new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help"));
SetMenuBar(menuBar);
CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!"));
}