CodeBlocks+wxWidgets

之前也安装过CodeBlocks,只是当时没有安装wxWidgets,试着新建一个wxWidgets工程后没有看到界面设计的东东就放弃了。今天发现群里的南果梨也在用CodeBlocks,在他的帮助也终于成功的安装了wxWidgets。
  1. 到www.CodeBlocks.org下载并安装CodeBlocks,最好下载MinGW版本的,可以省掉安装和配置GCC的麻烦。
  2. 到www.wxWidgets.org下载并安装wxWidgets,如果只开发Windows程序可以只下载wxMSW版本,如果你喜欢也可以下载wxAll版本。
  3. 编译wxWidgets,如果不知道如何编译可以使用下面的wxbuild.bat进行编译,编译过程大概30分钟。
  4. 因 为CodeBlocks是使用GCC编译器的,所以得先改一下编译选项以支持中文,到Settings->Compiler and debugger下的Other option标签中加入:-finput-charset=GBK,如果源文件是UTF-8或Unicode编码就改成相应的。
  5. 现在就可以新建wxWidgets工程了。

wxbuild.bat,运行脚本前先把CodeBlocks安装目录下的MinGW/bin/目录设到PATH变量里。

@echo off
cd build/msw
title 编译wxWidgets
echo 开始编译
echo ---------------------------------------------------------------------
echo 编译发行版本
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=0 UNICODE=1
echo 编译调试版本
mingw32-make -f makefile.gcc BUILD=debug SHARED=1 MONOLITHIC=0 UNICODE=1
echo ---------------------------------------------------------------------
echo 编译结束
pause

红色的是Unicode选项,如果你不需要Unicode的话可以把它设成0

 
新建项目选择wxWidgets Project

安装选择你安装的wxWidgets版本,我这里安装的是2.8.x

输入项目名称的位置

输入你的版权信息

这里选择wxSmith作为GUI设计工具,wxFormBuilder也可以编译GUI程序,不过现在还没搞明白怎么使用它的GUI设计工具

安装输入你的wxWidgets安装目录

这里默认就好了

这里选择使用wxWidgets的DLL和Unicode

按你需要选择相应的类库加到工程里

设计界面和运行后的结果

  有空研究一下wxFormBuilder是怎样使用的。

阅读更多

关于codeblocks+wxWidgets的问题

05-20

各位前辈高人,最近我想要写一个GUI程序,于是选择了wxWidgets库,安装方法选择的[u][url=http://www.cnblogs.com/aozima/archive/2011/10/03/2198653.html][/url][/u]rn这之后创建项目时,出现以下情况:rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C408%3Bap%3Dwxwidgets%B0%C9%2C90%2C416/sign=e856878891529822053339cbe7f118bb/21a4462309f790523657fc710df3d7ca7bcbd531.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C463%3Bap%3Dwxwidgets%B0%C9%2C90%2C471/sign=179b2ff486d6277fe912323018037c40/b999a9014c086e068d0f840403087bf40bd1cbde.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C459%3Bap%3Dwxwidgets%B0%C9%2C90%2C467/sign=40c33d64b151f819f1250342ea8f299d/f703738da9773912caca3e2ef9198618377ae295.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C464%3Bap%3Dwxwidgets%B0%C9%2C90%2C472/sign=8869036f00e9390156028d364bd73797/55e736d12f2eb9386fe0c1bdd4628535e4dd6ff4.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C457%3Bap%3Dwxwidgets%B0%C9%2C90%2C465/sign=4188152f4ec2d562f208d0e5d72af39f/9a504fc2d56285351d6d696e91ef76c6a6ef63f4.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C465%3Bap%3Dwxwidgets%B0%C9%2C90%2C473/sign=b04527938b13632715edc23ba1b4c39c/f603918fa0ec08faf0a7a8e858ee3d6d54fbdade.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C465%3Bap%3Dwxwidgets%B0%C9%2C90%2C473/sign=9aa77385ae51f3dec3b2b96ca4d5936f/8d5494eef01f3a292a446e819825bc315d607cf4.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C467%3Bap%3Dwxwidgets%B0%C9%2C90%2C475/sign=e3585a552934349b74066e8df9d176be/d52a2834349b033b9dc0479514ce36d3d539bd31.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C456%3Bap%3Dwxwidgets%B0%C9%2C90%2C464/sign=7bf536e6a8014c08193b28ad3a406178/4d086e061d950a7b90d9f58b0bd162d9f3d3c995.jpg][/img]rn我的全局环境变量设置如下:rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C339%3Bap%3Dwxwidgets%B0%C9%2C90%2C347/sign=1fb46749aec379317d688621dbffd435/024f78f0f736afc31e759a2ab219ebc4b7451207.jpg][/img]

codeblocks+wxWidgets项目可以编译,却无法运行。跪求大神

06-20

操作步骤:rn1.创建工程rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=989c7d659825bc312b5d01906ee4eec1/6159252dd42a283481f29ea05ab5c9ea14cebfc1.jpg][/img][img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=5e87916f30adcbef01347e0e9c944dad/a8ec8a13632762d079260c14a1ec08fa513dc605.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=eadc36ff024f78f0800b9afb490a6925/18d8bc3eb13533fa93ba3b85a9d3fd1f41345b08.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=50124c92b2de9c82a665f9875cbae37a/3b87e950352ac65cd272ced8faf2b21193138a22.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=77940119d058ccbf1bbcb53229e3df4e/342ac65c103853433fb82f8a9213b07eca808822.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=b9f2e4aa0b55b3199cf9827d7392e156/a71ea8d3fd1f4134813badd5241f95cad1c85e08.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C446%3Bap%3Dcodeblocks%B0%C9%2C90%2C454/sign=31d8568848540923aa696376a263b279/c8ea15ce36d3d5390a69a7683b87e950342ab0c1.jpg][/img]rn[img=http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C406%3Bap%3Dcodeblocks%B0%C9%2C90%2C414/sign=60c16aadaec379317d688621dbffd435/fc1f4134970a304e3d2e0851d0c8a786c9175c08.jpg][/img]rnrnrn2.编译通过rn编译信息:rn-------------- Build: Debug in 32 (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -Wno-attributes -Wall -g -D__WXDEBUG__ -finput-charset=UTF-8 -IC:\wxWidgets2.8\include -IC:\wxWidgets2.8\contrib\include -IC:\wxWidgets2.8\lib\gcc_dll\mswd -c "C:\Documents and Settings\Administrator\桌面\32\_2App.cpp" -o obj\Debug\_2App.ornmingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -Wno-attributes -Wall -g -D__WXDEBUG__ -finput-charset=UTF-8 -IC:\wxWidgets2.8\include -IC:\wxWidgets2.8\contrib\include -IC:\wxWidgets2.8\lib\gcc_dll\mswd -c "C:\Documents and Settings\Administrator\桌面\32\_2Main.cpp" -o obj\Debug\_2Main.ornwindres.exe -i C:\DOCUME~1\ADMINI~1\桌面\32\resource.rc -J rc -o obj\Debug\resource.res -O coff -IC:\wxWidgets2.8\include -IC:\wxWidgets2.8\lib\gcc_dll\mswd rnmingw32-g++.exe -LC:\wxWidgets2.8\lib\gcc_dll -o bin\Debug\32.exe obj\Debug\_2App.o obj\Debug\_2Main.o obj\Debug\resource.res -mthreads -lwxmsw28d_core -lwxbase28d -lwxpngd -lwxzlibd -mwindowsrnOutput size is 516.92 KBrnProcess terminated with status 0 (0 minutes, 2 seconds)rn0 errors, 0 warnings (0 minutes, 2 seconds)rnrn3.运行失败rn在执行目录下运行程序,提示缺少DLL。将DLL拷贝到执行目录下。(wxbase28d_gcc.dll,wxmsw28d_core_gcc.dll)rn[img=http://imgsrc.baidu.com/forum/w%3D580/sign=a7129c937af40ad115e4c7eb672d1151/0d338744ebf81a4cfc664762d62a6059242da6c1.jpg][/img]rnChecking for existence: C:\Documents and Settings\Administrator\桌面\32\bin\Debug\32.exernExecuting: "C:\Documents and Settings\Administrator\桌面\32\bin\Debug\32.exe" (in C:\Documents and Settings\Administrator\桌面\32\.)rnProcess terminated with status -1073741819 (0 minutes, 21 seconds)rn

没有更多推荐了,返回首页