﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-农妇，山泉，有点儿田-文章分类-Boost</title><link>http://www.cppblog.com/deadpunk/category/2140.html</link><description>我没有技术</description><language>zh-cn</language><lastBuildDate>Sun, 01 Jun 2008 09:15:01 GMT</lastBuildDate><pubDate>Sun, 01 Jun 2008 09:15:01 GMT</pubDate><ttl>60</ttl><item><title>boost 1_33_1在VC6.0上的安装、编译、配置</title><link>http://www.cppblog.com/deadpunk/articles/9477.html</link><dc:creator>活着就是折腾，所以当然要骠悍的折腾</dc:creator><author>活着就是折腾，所以当然要骠悍的折腾</author><pubDate>Thu, 06 Jul 2006 02:42:00 GMT</pubDate><guid>http://www.cppblog.com/deadpunk/articles/9477.html</guid><wfw:comment>http://www.cppblog.com/deadpunk/comments/9477.html</wfw:comment><comments>http://www.cppblog.com/deadpunk/articles/9477.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/deadpunk/comments/commentRss/9477.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deadpunk/services/trackbacks/9477.html</trackback:ping><description><![CDATA[
		<p>转载自：<a href="http://blog.csdn.net/roger_77/archive/2006/01/13/577998.aspx">http://blog.csdn.net/roger_77/archive/2006/01/13/577998.aspx</a><br /></p>
		<p>最近要使用boost库来进行一些跨平台的开发，比如使用thread线程库来开发多线程的程序。在网上找了一下，大部分关于boost安装编译的文档是在VS2003.net环境下进行的，关于boost在VC6.0上进行编译的比较少,由于本人的主要开发环境是VC6.0,所以自己动手进行了下面的boost配置编译工作。</p>
		<h3>
				<br />一.编译前的准备.</h3>
		<p>
				<br />本人的VS6.0安装在“D:\Program Files\Microsoft Visual Studio”目录，下载boost的地址"<a href="http://prdownloads.sourceforge.net/boost/boost_1_33_1.zip?download">http://prdownloads.sourceforge.net/boost/boost_1_33_1.zip?download</a>",<br /> boost解压后的根目录为："D:\C++\boost_1_33_1",<br />可参考改为相应的目录即可。</p>
		<h3>二.编译步骤<br /></h3>
		<p>1.修改“D:\C++\boost_1_33_1\tools\build\jam_src\build.bat”中的所有：<br />“C:\Program Files\Microsoft Visual Studio”为<br />“D:\Program Files\Microsoft Visual Studio”，也就是VS6.0的安装目录。</p>
		<p>2.执行：“<span class="Code">D:\C++\boost_1_33_1\tools\build\jam_src\build.bat</span>”<br />产生一个子文件夹“bin.ntx86”，里面有个可执行文件"bjam.exe"。</p>
		<p>3.拷贝这个可执行文件"bjam.exe"放到“D:\C++\boost_1_33_1”目录.</p>
		<p>4.添加“D:\C++\boost_1_33_1”到操作系统的环境变量path中，<br />SET path="D:\C++\boost_1_33_1";%PATH% </p>
		<p>5.打开控制台(cmd),在命令行执行后面的步骤.</p>
		<p>5.1 先执行以下命令,设置VC编译环境：</p>
		<p>
				<span class="Code">SET MSVC_ROOT="D:\Program Files\Microsoft Visual Studio\VC98" <br />SET VISUALC="D:\Program Files\Microsoft Visual Studio\VC98" <br />SET JAM_TOOLSET=VISUALC<br />SET PYTHON_ROOT=D:\Program Files\Python2.2.2<br />SET PYTHON_VERSION=2.2</span>
		</p>
		<p>5.2 进入“D:\Program Files\Microsoft Visual Studio\VC98\bin"目录，<br />运行"<span class="Code">VCVARS32.BAT</span>”，</p>
		<p>5.3 然后转到“D:\Program Files2\boost_1_33_1”目录,<br />最后运行下面的命令来编译boost库：（仍然是同一个控制台窗口!否则无效）<br /><span class="Code">bjam -sBOOST_ROOT=. -sTOOLS=msvc "-sBUILD=debug release static/dynamic" </span></p>
		<p>6.编译过程在boost的根目录下产生“bin\boost\libs”文件夹，约130兆；<br />整个过程约25分钟.</p>
		<p>7.为了以后在项目中配置方便，把编译出来的*.lib,*.dll文件搜索出来后，<br />把这些文件统一放到一个自己新建的目录下，比如libs_vc6目录。</p>
		<h3>
				<br />三.boost类库在VC6.0的IDE环境中的配置:<br /></h3>
		<p>1.VC6.0中菜单选择<br />“Tools” -&gt; “Options” -&gt; “Diretories” -&gt; “Show Diretories for”中的下拉框选择:<br />1) 在”Include files” 中添加boost根目录的路径,<br />2) 在”Source files” 中添加boost根目录的路径,<br />3) 在”Library files” 中添加刚才创建包含*.lib,*.dll文件的libs_vc6目录的路径,和“D:\C++\boost_1_33_1\libs”.</p>
		<p>2.然后自己写个程序测试一下即可，比如：<br /><font color="#000080">#include</font> &lt;boost/lexical_cast.hpp&gt;<br /><font color="navy">#include</font> &lt;iostream&gt;<br /><font color="brown">int</font> main()<br />{<br />        <font color="brown">using</font> boost::lexical_cast;<br />        <font color="brown">int</font> a = lexical_cast&lt;<font color="brown">int</font>&gt;("<font color="blue">123</font>");<br />        <font color="brown">double</font> b = lexical_cast&lt;<font color="brown">double</font>&gt;("<font color="blue">123.12</font>");<br />        std::cout&lt;&lt;a&lt;&lt;std::endl<br />        std::cout&lt;&lt;b&lt;&lt;std::endl;<br />        <font color="brown">return</font> 0;<br />}</p>
		<p>-----------------------------------------------------------------<br />参考：<br /><a href="http://www.cdown.net/Info/32600.html">http://www.cdown.net/Info/32600.html</a><br /><a href="http://dev.csdn.net/develop/article/18/18225.shtm">http://dev.csdn.net/develop/article/18/18225.shtm</a><br /><a href="http://www.boost.org/more/getting_started.html">http://www.boost.org/more/getting_started.html</a></p>
<img src ="http://www.cppblog.com/deadpunk/aggbug/9477.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deadpunk/" target="_blank">活着就是折腾，所以当然要骠悍的折腾</a> 2006-07-06 10:42 <a href="http://www.cppblog.com/deadpunk/articles/9477.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>