Visual Studio 2005下wxWidgets环境搭建

上个周末在研究 wxWidgets 的环境搭建, linux 下由于有 wx-config ,很快就搞定,但 windows 下想要编译出不依赖 visual studio 2005 的可执行文件花了不少时间。
特将过程记录 如下,以防日后忘却,再花冤枉时间。

 

1.       什么是 wxWidgets

wxWidgets lets developers create applications for Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more using one codebase. It can be used from languages such as C++, Python, Perl, and C#/.NET . Unlike other cross-platform toolkits, wxWidgets applications look and feel native . This is because wxWidgets uses the platform's own native controls rather than emulating them. It's also extensive, free, open-source, and mature . Why not give it a try, like many others have ?

      

2.       Visual Studio 2005 wxWidgets 的下载、安装与配置

a)        下载: http://wxwidgets.org/downloads/ 下载 wxMSW 版本的 wxWidgets ,下载下来的应该是一个 exe 的安装文件。

b)        安装: 运行下载下来的安装文件,安装在 D:/wxWidgets-2.8.0 目录 中。

c)         编译 Debug 版本的库: Visual Studio 2005 打开 build/msw/wx.dsw 文件, Solution Configurations 中选中 Unicode Debug ,直接 Build Solution 就可以编译出 Debug 版本的 wxWidgets 库了。

d)        编译 Relase 版本的库: Release 版本的 wxWidgets 库虽然也可以通过类似的 方法去编译,但编译出来的库仍然依赖于 visual studio 2005 的运行时库。 Debug 版本的库依赖 VS2005 也就算了,反正是自己调试用的。 Release 版本可是要给别人用的,再带上一大堆 dll 就不好了。为了解决这个问题,我们需要先在 Solution Configuration 中选中 Unicode Release ,然后在 Solution Explorer 中,针 对每一个 project 在项目属性的 C/C++ --> Code Generation --> Runtime Library 中选 Multi-Threaded (HOHO, 20 个项目要改属性啊 ~~~) 。最后再 Build Solution 就可以了。

 

关于不同的 Runtime Library 的信息,可参见:

http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=%22C+Run-Time+Libraries%22+site%3Amsdn.microsoft.com

 

e)         Visual Studio 2005 的配置:

打开 Tools --> Options --> Projects and Solutions --> VC++ Directories

                        i.        Include files 中加入 D:/wxWidgets-2.8.0/include

                      ii.        Library files 中加入 D:/wxWidgets-2.8.0/lib/vc_lib

 

f)         基于 wxWidgets 的项目的配置:

打开项目属性

                        i.        Debug 版本的配置:

C/C++ --> General --> Additional Include Directories 中写入: D:/wxWidgets-2.8.0/lib/vc_lib/mswud


C/C++ --> Code Generation --> Runtime Library
Multi-Threaded Debug DLL


Linker --> Input --> Additional Dependencies
写入: wxmsw28ud_core.lib wxbase28ud.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib


Linker --> Input --> Ignore Specific Library
写入: LIBCMTD.lib

 

                      ii.        Release 版本的配置:

C/C++ --> General --> Additional Include Directories 中写入: D:/wxWidgets-2.8.0/lib/vc_lib/mswu


C/C++ --> Code Generation --> Runtime Library
Multi-threaded


Linker --> Input --> Additional Dependencies
写入: wxmsw28u_core.lib wxbase28u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib

 


wxWidgets 的跨平台性,实现 i18n 的便利性以及功能的完备性让我越来越感兴趣。预计今后几年的 GUI 开发都将会基于 wxWidgets 了。

Farewell, MFC! Don’t cry for me, Microsoft!   :)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值