stdport 安装

段叶飞 @ 2006-05-23 22:07

 

可以在 http://sourceforge.net/projects/stlport 上down到最新的版本。

windows的vc8环境下
1.在环境变量的PATH中添加vc8的nmake,相当于linux下的make。例如我添加的是:E:\Microsoft Visual Studio 8\VC\bin。
2.在命令行模式下运行目录..\Microsoft Visual Studio 8\VC\下的vcvarsall.bat,设置好环境变量。我一开始就没有在命令行模式下运行,导致cl编译的时候出现error,中止。
3.按照STLPort目录下的INSTALL的步骤进行编译即可。最后编译的静态库放在STLPort\lib中,动态库放在STLPort\bin中。
4.把lib中的静态库拷贝到vc\lib中,STLPort\bin中动态库放在system32下面。在STLPort\stlport拷贝到vc\include下面。
5."Have fun"

Linux环境下
我 用的gcc4.0,按照INSTALL的步骤编译通过,生成.so文件。把这些文件放在/usr/local/lib中。在把STLPort下的头文件 集./stlport放在/usr/local/include/.然后写一个小的测试程序.在我的测试中遇到以下的问题和相应的解决如下:

Question 1:error while loading shared libraries: libstlport.so.5.0: cannot open shared object file: No such file or directory
Answer1:造成的原因是ld程序无法找到对应的动态库.应该在/etc/有一个ld.conf的配置文件,打开,加上路径/usr/local/lib/,然后运行ldconfig加载动态库,即可.

Quesion 2: 编译出现error :undefined reference to `stlpmtx_std::cout'
Answer2: 主要是在编译的时候没有加上-pthread选项.注意是编译选项.我知道在多线程有连接选项-lpthread,不要混淆.这是我花了一个晚上的时间才 搞定的问题.想起来就觉得郁闷.据我问一牛人的解释是-pthread这个为stlport带的编译选项.其实你在STLport的INSTALL中可以 看到下面一段话:

"You should read my mess more carefull: I say -pthread (not -lpthread). I.e. if you see stlpmtx_std:: namespace instead of stlp_std:: (or stlpd_std, if you work with _STLP_DEBUG), then you try to build mt-unsafe lib."

下面这段话是我在google上搜索到的:
"You build you app without MT (multithread) support.
You should read my mess more carefull: I say -pthread (not -lpthread). I.e. if you see stlpmtx_std:: namespace instead of stlp_std:: (or stlpd_std, if you work with _STLP_DEBUG), then you try to build mt-unsafe lib."
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值