Wednesday, April 2, 2008

wxWidgets编译命令行程序

VC2005编译wxWidgets过后,就可以使用wx来编写程序了。

一开始就写GUI程序可能比较麻烦,可以先从Console程序开始。

编写一个console程序,代码如下:

#include <wx/wx.h>
class App : public wxAppConsole {
public
:
bool OnInit();
int OnRun();
};
DECLARE_APP(App);
IMPLEMENT_APP_CONSOLE(App);
bool
App::OnInit(){
return true;
}
int App::OnRun(){
wxPuts( wxT("Hello you!") );
return EXIT_SUCCESS;
}

就可以编译完成了。嗯,OnRun函数一定要重载。

No comments:

Post a Comment