我在尝试使用Boost thread.hpp构建我的程序时遇到了非常奇怪的错误(版本1.54,但尝试也更低):
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:78: error: expected nested-name-specifier before 'float'
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:78: error: two or more data types in declaration of 'parameter'
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:86: error: expected nested-name-specifier before 'float'
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:86: error: two or more data types in declaration of 'parameter'
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:94: error: expected nested-name-specifier before 'float'
/home/seweryn/boost/include/boost/functional/hash/detail/float_functions.hpp:94: error: two or more data types in declaration of 'parameter'
float_functions.hpp(片段):
76. namespace boost {
77. namespace hash_detail {
78. template <typename Float>
79. struct call_ldexp {
80. typedef Float float_type;
81. inline Float operator()(Float x, int y) const {
82. return std::ldexp(x, y);
83. }
84. };
85.
86. template <typename Float>
87. struct call_frexp {
88. typedef Float float_type;
89. inline Float operator()(Float x, int* y) const {
90. return std::frexp(x, y);
91. }
92. };
93.
94. template <typename Float>
95. struct select_hash_type
96. {
97. typedef Float type;
98. };
99. }
100.}
构建命令是:
g++ -I/usr/include -I/home/seweryn/boost/include -I/home/seweryn/include -I/home/seweryn/libmpeg7.2/src -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/TestApp.d" -MT"src/TestApp.d" -o "src/TestApp.o" "../src/TestApp.cpp"
看起来Float
类型被识别为标准float
并导致错误。
我对C ++没有经验,所以感谢任何帮助。
由于
更新: 可能很重要的是,这个应用程序适用于以前的环境(Ubuntu)。将它移动到新的(CentOS)并安装Boost之后,它就失败了。