您的位置:首页 > 其它

vs2008 配置 wxwidgets 环境

2010-10-13 14:31 246 查看
1 、去官网 http://www.wxwidgets.org/downloads 下载一个wxMSW版本的 wxWidgets 。
有安装版和 压缩版的, 我这采用当时最新的 wxMSW-2.8.11
2、解压或者安装源文件包
      假如路径是: D:/wxMSW-2.8.11
3、编译
    用vs2008打开 D:/wxMSW-2.8.11/build/msw/wx.dsw
    然后出现转换工程的界面,选择全部。
    然后,配置编译的模式,如下选择:



然后点击 生成--》生成解决方案。。。等待编译结束。
编译好后设置:
1、包含文件路径:D:/wxWidgets-2.8.11/include
                              D:/wxWidgets-2.8.11/lib/vc_lib/mswd



2、库路径:              D:/wxWidgets-2.8.11/lib/vc_lib



新建一个空项目(wx):



加入hello.h
#ifndef INCLUDED_HELLOWORLDAPP_H
#define INCLUDED_HELLOWORLDAPP_H
/**
* The HelloWorldApp class
* This class shows a window containing a statusbar with the text 'Hello World'
*/
class HelloWorldApp : public wxApp
{
public:
virtual bool OnInit();
private:
wxButton *button;
};
DECLARE_APP(HelloWorldApp)
#endif // INCLUDED_HELLOWORLDAPP_H
加入 hello.cpp 文件
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "hello.h"
#include
IMPLEMENT_APP(HelloWorldApp)
/* this is executed upon startup, like 'main()' in non-wxWidgets programs */
bool HelloWorldApp::OnInit()
{
wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
frame->CreateStatusBar();
frame->SetStatusText(_T("Hello World"));
button = new wxButton((wxFrame *)frame, -2, _T("123"));
frame->Show(TRUE);
SetTopWindow(frame);
return true;
}
项目属性设置:
1、选择 unicode


2、预处理器定义     WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH



3 连接器输入
    加入这些常用库的支持:其中含有‘ud’ 说明是 unicode debug , 我编译的是 debug 版的。
wxmsw28ud_core.lib
wxbase28ud_net.lib
wxbase28ud.lib
wxtiffd.lib
wxjpegd.lib
wxpngd.lib
wxzlibd.lib
wxregexud.lib
wxexpatd.lib
winmm.lib
comctl32.lib
rpcrt4.lib
wsock32.lib
odbc32.lib



编译项目:
生成-->生成解决方案。
运行效果如图:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: