Boost歷史版本下載地址
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041
bat文件,boost 1.33.1 Python 2.2.1,可能需要重新安裝stl port, stl port版本有問題
::如果不要編譯bjam.exe的話
rem GOTO install
cd C:\boost_1_33_1\tools\build\jam_src
pause
call build.bat
pause
copy C:\boost_1_33_1\tools\build\jam_src\bin.ntx86\bjam.exe C:\boost_1_33_1
pause
:install
rem SET INCLUDE=\"C:\\STLport-4.6.2\\stlport\";%INCLUDE%
rem SET LIB=\"C:\\STLport-4.6.2\\lib\";%LIB%
SET MSVC_ROOT="C:\Program Files\Microsoft Visual Studio\VC98"
SET VISUALC="C:\Program Files\Microsoft Visual Studio\VC98"
SET JAM_TOOLSET=VISUALC
SET PYTHON_ROOT=C:\Python22
SET PYTHON_VERSION=2.2
SET STLPORT_PATH=C:\STLport-4.6.2\lib
SET STLPORT_VERSION=4.6.2
cd c:\Program Files\Microsoft Visual Studio\VC98\bin
pause
call VCVARS32.BAT
pause
cd C:\boost_1_33_1
pause
::stage代表 lib
::msvc-stlport是msvc-stlport-tools.jam文件,可以搜索得到
::--with-thread是只編譯thread庫,--without-thread則相反
::比如編譯thread 的lib庫如下行.
rem bjam -sBOOST_ROOT=. -sTOOLS=msvc --with-thread stage
::編譯所有
bjam -sBOOST_ROOT=. -sTOOLS=msvc-stlport install
bjam -sBOOST_ROOT=. -sTOOLS=msvc install
::編譯regex
rem bjam -sBOOST_ROOT=. -sTOOLS=msvc-stlport --with-regex install
rem bjam -sBOOST_ROOT=. -sTOOLS=msvc --with-regex install
::編譯thread
rem bjam -sBOOST_ROOT=. -sTOOLS=msvc-stlport --with-thread install
rem bjam -sBOOST_ROOT=. -sTOOLS=msvc --with-thread install
pause
exit
1、下載python-2.5.2.msi安裝到C:\Python25
http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
2、下載boost_1_35_0,解壓到C:\boost_1_35_0
http://sourceforge.net/project/downloading.php?group_id=7586&use_mirror=nchc&filename=boost_1_35_0.zip&48604828
3、執(zhí)行C:\boost_1_35_0\tools\jam\build_dist.bat
4、生成了bjam.exe在:C:\boost_1_35_0\tools\jam\src\bin.ntx86\bjam.exe
5、拷貝bjam.exe到C:\boost_1_35_0
6、打開cmd,執(zhí)行:cd C:\boost_1_35_0
7、執(zhí)行bjam --toolset=msvc -sPYTHON_ROOT="{C:\Python25}" install
bjam --toolset=msvc-6.0 stdlib=stlport -sPYTHON_ROOT="{C:\Python25}" install
等待半個小時左右
8、將C:\boost_1_35_0\libs文件夾(里面是源代碼,lib_source),拷貝到C:\Boost,并更改名為boost_src,這樣就成了C:\Boost\boost_src
9、把C:\Boost\include\boost-1_35_0\boost,加入到VC6的Include路徑,hpp也是C++的頭文件啊!Boost庫就是用的這個。
10、將C:\Boost\include\boost-1_35_0\boost和C:\Boost\boost_src,加入到VC6的source路徑
11、把C:\Boost\lib,加入到VC6的LIB路徑
12、C:\boost_1_35_0這個文件夾可以刪除了,如果不想刪除,那么C:\boost_1_35_0\bin.v2這個是編譯時候的obj等文件,可以刪除掉。
運(yùn)行出現(xiàn)的錯誤
1、預(yù)定義頭要加入:,D_STLP_DEBUG,__STL_DEBUG
2、ZM limit 錯誤:工程->設(shè)置->C/C++選項(xiàng)卡下面有“工程選項(xiàng)”的一個命令區(qū)在命令行的末尾加上/Zm1000,改為/Zm2000也行,是整百的都可以
3、“compiler is out of heap space”,\ZM改成2000(最大了)
4、“Fatal Error C1063”,這個錯誤是編譯器棧溢出,可能是你的程序單個源文件太大了,拆分成小一些的文件試試
MSDN上:
Fatal Error C1063
compiler limit : compiler stack overflow
The program was too complex, possibly due to recursive include files. Split the code into smaller source files and recompile.
手動編譯boost::regex
1、cmd;
2、cd C:\boost_1_35_0\libs\regex\build
3、vcvars32.bat
4、SET STLPORT_PATH=C:\STLport\lib(如果需要以STLPort編譯的話)
5、nmake -f vc6-stlport.mak(STLPort編譯)或者 nmake -f vc6.mak(普通編譯)
用來測試的代碼,建立一個Win32 Console Application:
#include "stdafx.h"
#include <iostream>
#include <boost/regex.hpp>
#include <boost/thread.hpp>
int main()
{
// 3 digits, a word, any character, 2 digits or "N/A",
// a space, then the first word again
boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1");
std::string correct="123Hello N/A Hello";
std::string incorrect="123Hello 12 hello";
assert(boost::regex_match(correct,reg)==true);
assert(boost::regex_match(incorrect,reg)==false);
boost::regex reg1("(new)|(delete)");
boost::smatch m;std::string s= "Calls to new must be followed by delete. \ Calling simply new results in a leak!";
if (boost::regex_search(s,m,reg1))
{ // Did new match?
if (m[1].matched)
std::cout << "The expression (new) matched!\n";
if (m[2].matched)
std::cout << "The expression (delete) matched!\n";
}
return 0;
}
如果一切順利通過,恭喜你,boost安裝成功。
1
vc 6 sp5補(bǔ)丁 預(yù)處理補(bǔ)丁
python2.2.3
stlport4.5.3
boost1.3.0.2
2
使用stlport的iostream,boost.python編譯失敗
如果禁用stlportt的iostream,boost.regex編譯失敗
選擇boost1.3.0.2的原因:
從
http://engineering.meta-comm.com/boost.aspx
得知Boost-wide regression reports
vc6基本支持boost1.3.0.2 的全部庫
而boost以后的版本,vc6 的表現(xiàn)可以說是慘不忍睹。
boost1.3.0.2支持 python2.2 stlport 4.5.3
基本就是這個樣子了。