现在的位置: 首页 > 综合 > 正文

STL Port编译,Windows/Linux

2018年10月03日 ⁄ 综合 ⁄ 共 1914字 ⁄ 字号 评论关闭

Window下

一、下载

      文件名:STLport-5.2.1.tar.bz2

      下载地址:

            http://www.stlport.org/download.html   

            http://sourceforge.net/projects/stlport/

二、解压缩

      将STLport-5.2.1.tar.bz2解压缩到:D:\Installed software for develop\STLport-5.2.1。

三、编译

3.1 打开

      开始 --> 所有程序 --> Microsoft Visual Studio 2010  --> Visual Studio Tools  --> Visual Studio 命令提示(2010)

3.2 配置编译环境

      切换目录:cd D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1

      配置编译环境:configure msvc9   (执行configure msvc10 ,出现Unknown compiler: msvc10,msvc9 即可)

3.3 编译

      切换目录:cd D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1\build\lib

      编译: nmake clean install

四、生成结果

      生成stlport.5.2.dll,在目录:D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1\bin下。

      生成stlport.5.2.lib,在目录:D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1\lib下。

五、错误处理

 5.1 错误现象

      编译时,出现如下错误:

D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1\stlport\stl/_cstdl
ib.h(158) : error C2084: 函数“__int64 abs(__int64)”已有主体
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\../includ
e/stdlib.h(471) : 参见“abs”的前一个定义
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\cl.EXE"”: 返回代码“0x2”
Stop.

5.2 错误处理

      找到_cstdlib.h文件第158行,(D:\Installed software for develop\STLport-5.2.1\STLport-5.2.1\stlport\stl\_cstdlib.h)将:

inline _STLP_LONG_LONG  abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }

      改为

#if !defined(_STLP_MSVC) || (_STLP_MSVC < 1600)
inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
#endif

      重新执行nmake clean install编译。


参考资料:http://www.cnblogs.com/sbaicl/articles/BaiCL.html

Linux下

一、下载

      文件名:STLport-5.2.1.tar.bz2

      下载地址:

            http://www.stlport.org/download.html   

            http://sourceforge.net/projects/stlport/

二、解压缩

      将STLport-5.2.1.tar.bz2解压缩到:/opt/STLport-5.2.1。

      tar jxvf STLport-5.2.1.tar.bz2。

三、编译

     cd /opt/STLport-5.2.1/build/lib

     make -f gcc.mak depend
     make -f gcc.mak install

四、生成结果

      生成libstlport.so,在目录/usr/local/lib/下。


参考资料:http://www.linuxidc.com/Linux/2011-12/48703.htm

抱歉!评论已关闭.