gpt4 book ai didi

c++ boost 1.71编译错误C2061语法错误: identifier 'L'

转载 作者:行者123 更新时间:2023-11-28 04:08:48 26 4
gpt4 key购买 nike

我最近通过 vcpkg 升级到 Boost 1.71 x64-windows。在升级前完美编译的 Visual Studio 2017 项目上,我现在收到此错误:

2> \x64-windows\include\boost\test\tools\floating_point_comparison.hpp(60): error C2061: syntax error: identifier 'L'
2> \x64-windows\include\boost\test\tools\floating_point_comparison.hpp(68): note: see reference to class template instantiation 'boost::math::fpc::is_abstract_class_or_function<T>' being compiled
2> \x64-windows\include\boost\log\utility\formatting_ostream.hpp(562): note: see reference to function template instantiation 'boost::log::v2_mt_nt6::basic_formatting_ostream<char,std::char_traits<CharT>,std::allocator<char>> &boost::log::v2_mt_nt6::basic_formatting_ostream<CharT,std::char_traits<CharT>,std::allocator<char>>::formatted_write<_Elem>(const OtherCharT *,std::streamsize)' being compiled

不确定问题是在 Boost::Log 还是 Boost::Test 中。这是 floating_point_comparison.hpp 中有问题的代码:

template<typename T>
class is_abstract_class_or_function
{
typedef char (&Two)[2];
template<typename U> static char test(U(*)[1]); // <- ***
template<typename U> static Two test(...);

public:
static const bool value =
!is_reference<T>::value
&& !is_void<T>::value
&& (sizeof(test<T>(0)) == sizeof(Two));
};

输出中没有与我的代码有关的错误。事实上,我从项目中删除了所有 .cpp 源文件(只留下头文件),但仍然出现编译错误。

最佳答案

你在某个地方有一个宏,类似于:#define U(str) L##str

所以 U(*) 变成了 L*,但是 U 没有变成 L.

关于c++ boost 1.71编译错误C2061语法错误: identifier 'L' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58238425/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com