Sun C++ Compilers and Boost

蓝咒 提交于 2019-12-06 09:06:43
Chris Huang-Leaver

I have had some success with Boost and Sun's CC compiler on Solaris 10, but it is a pain. The main thing to remember is you need,

 -library=stlport4 -features=tmplife -features=tmplrefstatic

in you CXXFLAGS for everything you compile, all the template only libraries I have tried seem to work fine with this,(skip all the libraries which need compiling, see here for details )

This does mean of course, that you will have to rebuild any libraries you need to link to (you would be very lucky if they already used stlport4).

Sadly, this is about the only (tenuously) valid reason for not using Boost :-(

Sun C++ Frontend tails blog

I've fought through this problem myself in the past, and it's a pain in the rear.

To be slightly more specific on Chris Huang-Leaver's answer, you really need to use STLPort4 on the Sun compilers. The default STL delivered by Sun is incomplete, per their own documentation (I'll track it down at some point). The other options that Chris mentions are helpful, but they're not really the root of the problem.

The good news is that Sun also delivers STLPort version 4 with their compilers, so all you need is to include the "-library=stlport4" flag in order to switch over to it. Why they deliver two versions (one semi-broken) of the STL, rather than just one correct version, is beyond me.

I guess since an exact answer has not been provided I must post one myself.

opensolaris(2009.06) and boost-1.4.1 seem to work well. The ./bjam picks the right switches and boost::mpl seems to work well with the sun compiler present. So, as far as I can tell the mpl documentation on compiler support is quite outdated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!