vs2008 配置 wxwidgets 环境

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

编译项目:

生成-->生成解决方案。

运行效果如图:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值