stlport源代码,可以添加到vs2005,过程也很容易。
下载最新的STLport:
http://sourceforge.net/project/showfiles.php?group_id=146814&package_id=162032
我下的是5.1.5版本的。
解压到c盘,然后进入C:\Program Files\Microsoft Visual Studio 8\Common7\Tools
添加路径到vcvarsall.bat,就可以了,要添加include和lib。
刚下载的文件解压后,没有lib文件夹,没有关系,修改后的部分如下下划线区域:
@set PATH=C:\qt-win-commercial-src-4.3.1\bin;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=C:\STLport-5.1.3\STLport-5.1.3\stlport;C:\qt-win-commercial-src-4.3.1\include;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;%INCLUDE%
@set LIB=C:\STLport-5.1.3\STLport-5.1.3\lib;C:\qt-win-commercial-src-4.3.1\lib;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB
开始编译,适用vs2005自带的命令行。
进入build路径的lib,先查看configure命令。
configure --help 可以看到相关的编译器的设置:
configure -c msvc8
下面就会提示相应的操作:
nmake /fmsvc.mak
接下来:
nmake /fmsvc.mak install
接下来把上面的标记部分添加到vs2005的vc目录路径,而且放在最上面,还不够,还要把bin里面的所有文件都复制到vc的bin文件夹目录下:
C:\Program Files\Microsoft Visual Studio 8\VC\bin
还有lib下C:\Program Files\Microsoft Visual Studio 8\VC\lib,不过我试过了,可以不复制。
到此就可以开始写一个程序,使用的就是stlport的库:
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> a;
return 0;
}
对#include <vector>的vector右键,出现”打开文档vector”,就看到的是stl的vector文档。
如下:
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_VECTOR
#define _STLP_VECTOR
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x77
# include <stl/_prolog.h>
# endif
# ifdef _STLP_PRAGMA_ONCE
# pragma once
# endif
# ifndef _STLP_INTERNAL_ALGOBASE_H
# include <stl/_algobase.h>
# endif
#ifndef _STLP_INTERNAL_VECTOR_H
# include <stl/_vector.h>
#endif
……