前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >这都是什么错误

这都是什么错误

作者头像
用户3519280
发布2023-07-08 14:39:47
1920
发布2023-07-08 14:39:47
举报
文章被收录于专栏:c++ 学习分享

将版本v142改成v140就出现了这个问题

代码语言:javascript
复制
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(405): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(406): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(413): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(414): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(415): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(495): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(500): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(500): note: 请参见“--”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(502): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(502): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(503): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(503): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(504): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(504): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(505): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(505): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(506): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(506): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(508): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(508): note: 请参见“++”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(493): error C3259: “constexpr”函数只能有一个 return 语句
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(515): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(520): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(520): note: 请参见“--”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(522): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(522): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(523): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(523): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(524): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(524): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(525): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(525): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(526): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(526): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(527): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(527): note: 请参见“|=”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(529): error C3249: “constexpr”函数的语句或子表达式非法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(529): note: 请参见“++”的用法
1>D:\Cgal\cmake\boost_1_82_0\output\vc14.2-x64\include\boost-1_82\boost/core/bit.hpp(513): error C3259: “constexpr”函数只能有一个 return 语句

出问题的都是类似这种 x = x - ( ( x >> 1 ) & 0x55555555 );

代码语言:javascript
复制
BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
    x = x - ( ( x >> 1 ) & 0x55555555 );
    x = ( x & 0x33333333 ) + ( ( x >> 2 ) & 0x33333333 );
    x = ( x + ( x >> 4 ) ) & 0x0F0F0F0F;

    return static_cast<unsigned>( ( x * 0x01010101 ) >> 24 );
}
代码语言:javascript
复制
BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
    x = x - ( ( x >> 1 ) & 0x5555555555555555 );
    x = ( x & 0x3333333333333333 ) + ( ( x >> 2 ) & 0x3333333333333333 );
    x = ( x + ( x >> 4 ) ) & 0x0F0F0F0F0F0F0F0F;

    return static_cast<unsigned>( ( x * 0x0101010101010101 ) >> 56 );
}
代码语言:javascript
复制
BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
    if( x == 0 )
    {
        return 0;
    }

    --x;

    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;

    ++x;

    return x;
}

BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
    if( x == 0 )
    {
        return 0;
    }

    --x;

    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;
    x |= x >> 32;

    ++x;

    return x;
}

改的是boost里面的头文件\include\boost-1_82\boost\math\tools config

代码语言:javascript
复制
#define BOOST_MATH_NO_MP_TESTS
//#if (__cplusplus > 201400L || _MSVC_LANG > 201400L)
#if (__cplusplus > 201402L || _MSVC_LANG > 201402L)
//#define BOOST_CXX14_CONSTEXPR constexpr
#define BOOST_CXX14_CONSTEXPR constexpr
#else
#define BOOST_CXX14_CONSTEXPR
#define BOOST_NO_CXX14_CONSTEXPR
#endif // BOOST_CXX14_CONSTEXPR

#if (__cplusplus > 201402L || _MSVC_LANG > 201402L) 直接跳过这个版本

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-06-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档