【发布时间】:2018-03-07 15:43:02
【问题描述】:
我正在使用 VS 2017 社区版、英特尔编译器 17.00 更新 6 和 boost 1.66,试图了解 boost::multiprecision::float128 的方法。从字面上看,从here 中获取示例代码并将其放入 VS 的新项目中。
编译给出了多个错误,大致分为两个类别/文件:
-
在float128.hpp中:
三个错误“错误:标识符“xxx”未定义”,用于 fmaq、remquoq 和剩余量。事实上,我无法找到它们的定义 - 缺少包含?
全局范围没有“signbitq” - 这又看起来像是缺少定义(即与上面相同)
对于 GCC,上述函数可以在 quadmath.h 中找到,但是,在使用 ICC 时,boost 标头似乎不包含它(即设置了 BOOST_MP_USE_QUAD)。
- 在 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\xutility 中:此声明不允许使用显式模板参数列表。有三项罪名
我假设我需要从 VS 中删除默认放入的东西,但我不知道究竟是什么。
感谢您的帮助
编辑:上面的错误 #2 实际上根本不反对提升(我应该把它移到一个单独的问题吗?)。 从here! 复制的以下代码未在我的设置中编译:
#include <iostream>
#include <string>
int main() {
std::string str("Test string");
for (std::string::iterator it = str.begin(); it != str.end(); ++it)
std::cout << *it;
std::cout << '\n';
return 0;
}
确切的错误(其中之一)是:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\xutility(680): error : an explicit template argument list is not allowed on this declaration
1> _INLINE_VAR constexpr bool _Is_iterator_v<_Ty, void_t<_Iter_cat_t<_Ty>>> = true;
1> ^
1> detected during:
1> instantiation of "const bool std::_Is_iterator_v [with _Ty=char *, <unnamed>=void]" at line 520 of "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\string"
1> instantiation of "std::basic_string<_Elem, std::char_traits<_Elem>, std::allocator<_Elem>> std::_Integral_to_string<_Elem,_Ty>(_Ty) [with _Elem=char, _Ty=int]" at line 554 of "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\string"
我发现this 表明使用的特定版本(ICC-17.0 Up6 和 VS 15.6)可能存在问题,但是我无法真正迁移到新的英特尔编译器,也无法测试 VS 15.4
【问题讨论】:
-
还有其他增强功能对您有用吗?
-
xutility 中的错误发生在其他 boost 函数中(从 special_functions 中尝试了一些) - 感谢您指出这一点
-
希望对上述内容进行一些扩展 - getting started page 中的代码可以编译并运行。当我尝试使用其他功能时,即
#include <boost/math/special_functions/detail/bessel_k1.hpp> int main() { boost::math::detail::bessel_k1(1.0f); return 0; }它不会编译问题中的第二个错误。 -
看起来您的 Visual Studio 版本中使用的标准库与英特尔编译器版本根本不兼容。那是一个表演停止者。如果是这种情况,您需要更换一个。
-
@sehe,你似乎是对的 回复:VS,我已经在英特尔的论坛上发布了一个更基本的失败代码,我们将看看这些人的想法。回复:float128,是的,正在使用该选项编译代码。
标签: c++ visual-studio boost icc boost-multiprecision