How to compile Boost with an older std of C++? (C++03 in particular)

Deadly 提交于 2019-12-22 03:43:15

问题


I am working in a project dependent of Boost (http://kratos-wiki.cimne.upc.edu/index.php/Main_Page), this project currently only supports C++03. With the last update of gcc++ (v.5) the C++11 has become the default std, technically I solved the problem modifying the CXX_FLAGS adding:

-std=c++03

The problem comes with the Boost library, which I am not able to compile with the C++03 std (I think, I don't know how to check with which std I have compiled). I tried employing the following command to compile Boost:

./b2 install stage --with-python --with-serialization cxxflags="-std=c++03"

I have tried too modify the Jamroot file, adding the following lines:

  <toolset>gcc:<cxxflags>-std=gnu++03
  <toolset>clang:<cxxflags>-std=c++03

But the problem persist, when I compile the whole project I obtain the following kind of warning (several times):

/usr/local/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")

That's why I suspect that my changes do not take effect.

Thank you very much for your help


回答1:


I think you can safely ignore those warnings for now. I am compiling boost 1_60_0 with gcc 5.2.1 and std=c++11, and I get the same warnings. There is a ticket on it, but meanwhile it hasn't caused me any problems at this time. I commented out the two [#pragma warning] lines in the boost code, so I don't get a lot of distracting output in my build:

boost/type_traits/detail/template_arity_spec.hpp line 13:

// noisy: # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")

boost/type_traits/detail/bool_trait_def.hpp line 18:

// noisy: # pragma message ("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")

UPDATE The problem still exists in boost 1.61.0. I used the same exact fix again.



来源:https://stackoverflow.com/questions/34480467/how-to-compile-boost-with-an-older-std-of-c-c03-in-particular

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