0

尝试使用包含的 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 后,它失败了。

4

0 回答 0