您的位置:首页 > 运维架构 > Linux

STL Port编译,Windows/Linux

2015-01-16 08:49 435 查看
http://blog.csdn.net/liuxuezong/article/details/6770511

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: