Felomeng:windows下配置Code::Blocks和wxWidgets(C++的免费图形界面IDE)

<p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-size: small;"><span style="">本人使用的版本:</span><span lang="EN-US"><span style="font-family: Calibri;">winXp sp3 msdn</span></span><span style="">版,</span><a href="http://download.csdn.net/source/1230175"><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks 8.02</span></span><span style="">版,</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets 2.8.10</span></span></a><span style=""><a href="http://download.csdn.net/source/1230175">版</a>。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">1.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">下载安装带</span><span lang="EN-US"><span style="font-family: Calibri;">mingw</span></span><span style="">的</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">(这个就不详细说了,直接下载</span><span lang="EN-US"><span style="font-family: Calibri;">exe</span></span><span style="">版的很容易搞定),使用标准安装(默认安装</span><span lang="EN-US"><span style="font-family: Calibri;">wxSmith</span></span><span style="">插件),假设</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">装在</span><span lang="EN-US"><span style="font-family: Calibri;">D:\Program Files\CodeBlocks</span></span><span style="">中。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">2.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">安装好之后启动</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">,会出现一个编译器选项对话框,选择第一个</span><span lang="EN-US"><span style="font-family: Calibri;">GUN GCC Compiler</span></span><span style="">(后面有</span><span lang="EN-US"><span style="font-family: Calibri;">detected</span></span><span style="">标志)就能编译</span><span lang="EN-US"><span style="font-family: Calibri;">C/C++</span></span><span style="">项目了</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">3.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">在系统</span><span lang="EN-US"><span style="font-family: Calibri;">-&gt;</span></span><span style="">高级</span><span lang="EN-US"><span style="font-family: Calibri;">-&gt;</span></span><span style="">环境变量</span><span lang="EN-US"><span style="font-family: Calibri;">-&gt;Path</span></span><span style="">中添加:</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">a)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span lang="EN-US"><span style="font-size: small; font-family: Calibri;">D:\Program Files\CodeBlocks\MinGW\libexec\gcc\mingw32\3.4.5; </span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">b)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">和</span><span lang="EN-US"><span style="font-family: Calibri;">D:\Program Files\CodeBlocks\MinGW\bin;</span></span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">4.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">这里开始安装</span><span lang="EN-US"><span style="font-family: Calibri;">wxwidgets</span></span><span style="">,先到网站下载完全版(或</span><span lang="EN-US"><span style="font-family: Calibri;">windows</span></span><span style="">相应版本,叫做</span><span lang="EN-US"><span style="font-family: Calibri;">MSW</span></span><span style="">,即</span><span lang="EN-US"><span style="font-family: Calibri;">Microsoft windows</span></span><span style="">)</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">5.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">解压软件到目标目录(这里假设为</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10</span></span><span style="">)</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">6.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">开始菜单</span><span lang="EN-US"><span style="font-family: Calibri;">-&gt;</span></span><span style="">运行</span><span lang="EN-US"><span style="font-family: Calibri;">-&gt;cmd-&gt;</span></span><span style="">回车进入命令行</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">7.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">切换到目录</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\build\msw</span></span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">8.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">执行命令</span><span lang="EN-US"><span style="font-family: Calibri;">mingw32-make -f makefile.gcc BUILD=debug UNICODE=1</span></span><span style="">(详细的参数见</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\INSTALL-MSW.txt</span></span><span style="">),这里参数很关键,</span><span lang="EN-US"><span style="font-family: Calibri;">BUILD</span></span><span style="">选项共两个参数</span><span lang="EN-US"><span style="font-family: Calibri;">debug</span></span><span style="">和</span><span lang="EN-US"><span style="font-family: Calibri;">release</span></span><span style="">。因为选项用</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">编译</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">项目时必须编译成相应的目标(</span><span lang="EN-US"><span style="font-family: Calibri;">build target</span></span><span style="">中的</span><span lang="EN-US"><span style="font-family: Calibri;">debug</span></span><span style="">对</span><span lang="EN-US"><span style="font-family: Calibri;">debug</span></span><span style="">),否则会提示找不到</span><span lang="EN-US"><span style="font-family: Calibri;">libwxmsw28ud_core/libwxmsw28u_core</span></span><span style="">等。</span><span lang="EN-US"><span style="font-family: Calibri;">Unicode</span></span><span style="">道理也一样,这里</span><span lang="EN-US"><span style="font-family: Calibri;">1</span></span><span style="">表示使用</span><span lang="EN-US"><span style="font-family: Calibri;">Unicode</span></span><span style="">,</span><span lang="EN-US"><span style="font-family: Calibri;">0</span></span><span style="">表示不使用</span><span lang="EN-US"><span style="font-family: Calibri;">Unicode</span></span><span style="">。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">9.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">切换到目录</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\samples\minimal</span></span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">10.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">执行命令</span><span lang="EN-US"><span style="font-family: Calibri;">mingw32-make -f makefile.gcc BUILD=debug UNICODE=1</span></span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">11.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">打开</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">中</span><span lang="EN-US"><span style="font-family: Calibri;">compiler and debugger settings</span></span><span style="">,在</span><span lang="EN-US"><span style="font-family: Calibri;">Linker settings-&gt;link libraries</span></span><span style="">中添加</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\lib\gcc_dll\</span></span><span style="">目录下所有</span><span lang="EN-US"><span style="font-family: Calibri;">*.a</span></span><span style="">文件。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">12.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">在</span><span lang="EN-US"><span style="font-family: Calibri;">Search directories</span></span><span style="">里的</span><span lang="EN-US"><span style="font-family: Calibri;">Compiler</span></span><span style="">里面添加上</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\lib\gcc_dll\mswu\wx</span></span><span style="">。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">13.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">新建一个</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets project</span></span><span style="">,按提示填写相应的保存目录和版权信息,其中</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">a)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span lang="EN-US"><span style="font-family: Calibri;">preferred GUI builder</span></span><span style="">中可以选择</span><span lang="EN-US"><span style="font-family: Calibri;">wxSmith</span></span><span style="">;</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">b)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets location</span></span><span style="">,在</span><span lang="EN-US"><span style="font-family: Calibri;">base</span></span><span style="">里面选择</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10</span></span><span style="">就可以了;</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">c)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets Library Setting</span></span><span style="">里面的设置必须和</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">编译选项相一致(本例中采用的是</span><span lang="EN-US"><span style="font-family: Calibri;">enable Unicode</span></span><span style="">,另外两项不选)。</span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style=""><span style="font-size: small;">常见问题解决:</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">1.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">找不到</span><span lang="EN-US"><span style="font-family: Calibri;">wx/setup.h</span></span><span style="">,</span><span lang="EN-US"><span style="font-family: Calibri;">libwxmsw*</span></span><span style="">,</span><span lang="EN-US"><span style="font-family: Calibri;">*.h</span></span><span style="">等文件</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">a)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">查看</span><span lang="EN-US"><span style="font-family: Calibri;">build target</span></span><span style="">是否与</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">编译选项相一致,</span><span lang="EN-US"><span style="font-family: Calibri;">debug</span></span><span style="">对</span><span lang="EN-US"><span style="font-family: Calibri;">debug</span></span><span style="">,</span><span lang="EN-US"><span style="font-family: Calibri;">release</span></span><span style="">对</span><span lang="EN-US"><span style="font-family: Calibri;">release</span></span><span style="">。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">b)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">在</span><span lang="EN-US"><span style="font-family: Calibri;">Linker settings-&gt;link libraries</span></span><span style="">中添加</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\lib\gcc_dll\</span></span><span style="">目录下所有</span><span lang="EN-US"><span style="font-family: Calibri;">*.a</span></span><span style="">文件。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">c)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">在</span><span lang="EN-US"><span style="font-family: Calibri;">Search directories-&gt;compiler</span></span><span style="">里添加</span><span lang="EN-US"><span style="font-family: Calibri;">D:\wxWidgets-2.8.10\lib\gcc_dll\mswu\wx</span></span><span style="">。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">d)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">编译有问题或路径设置有问题(路径中最好不要包含汉字)。</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">2.</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">脚本异常,</span><span lang="EN-US"><span style="font-family: Calibri;">\CodeBlocks\share\CodeBlocks\templates\wizard\wxwidgets\ wizard.script</span></span><span style="">中的</span><span lang="EN-US"><span style="font-family: Calibri;">XX</span></span><span style="">行执行错误</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">a)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">肯定是设置地有问题,首先检查有没有使用汉语路径,如果使用了,改一下,然后进行</span><span lang="EN-US"><span style="font-family: Calibri;">b</span></span><span style="">;</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">b)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">将</span><span lang="EN-US"><span style="font-family: Calibri;">Code::Blocks</span></span><span style="">的设置信息删除(位置在系统盘中的</span><span lang="EN-US"><span style="font-family: Calibri;">\Documents and Settings\</span></span><span style="">你的用户名</span><span lang="EN-US"><span style="font-family: Calibri;">\Application Data</span></span><span style="">,删除其中的</span><span lang="EN-US"><span style="font-family: Calibri;">codeblocks</span></span><span style="">文件夹,然后进行</span><span lang="EN-US"><span style="font-family: Calibri;">c</span></span><span style="">;</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">c)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">重新进行正文中</span><span lang="EN-US"><span style="font-family: Calibri;">11-13</span></span><span style="">步的设置;</span></span></p>
<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-size: small; font-family: Calibri;">d)</span><span style='font: 7pt "Times New Roman";'> </span></span></span><span style="font-size: small;"><span style="">如果问题没有解决,删除</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">所在目录的所有东西(可能需要重新启动</span><span lang="EN-US"><span style="font-family: Calibri;">explorer.exe</span></span><span style="">),取消使用汉字目录,删除</span><span lang="EN-US"><span style="font-family: Calibri;">Code::blocks</span></span><span style="">的设置信息,从编译</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">(正文第</span><span lang="EN-US"><span style="font-family: Calibri;">5</span></span><span style="">步)重新编译</span><span lang="EN-US"><span style="font-family: Calibri;">wxWidgets</span></span><span style="">和设置环境。</span></span></p>

你可能感兴趣的:(wxwidgets)