Skip to content

宏与boost库中的函数重名 #7

Description

@HuangDuoYan

#define for_each_dimension(variable) for ( int variable = 0; variable < 2; variable++ )

取消注释前,编译出错:

[ 11%] Building CXX object CMakeFiles/iccad19gr.dir/home/huang/cu-gr/rsyn/src/rsyn/session/Session.cpp.o
In file included from /home/huang/cu-gr/src/../rsyn/src/rsyn/util/dbu.h:28,
                 from /home/huang/cu-gr/rsyn/src/rsyn/phy/util/PhysicalTransform.h:20,
                 from /home/huang/cu-gr/rsyn/src/rsyn/phy/util/PhysicalTransform.cpp:16:
/home/huang/cu-gr/src/../rsyn/src/rsyn/util/dim.h:46:38: error: expected unqualified-id before ‘for’
   46 | #define for_each_dimension(variable) for ( int variable = 0; variable < 2; variable++ )
      |                                      ^~~
/usr/include/boost/geometry/util/algorithm.hpp:99:32: error: invalid use of template-name ‘boost::UnaryFunction’ without an argument list
   99 | constexpr inline UnaryFunction for_each_dimension(UnaryFunction function)

注释后,编译通过。

附加信息

boost版本:

dpkg -l | grep libboost

命令输出的第一行:

ii  libboost-all-dev                                 1.83.0.1ubuntu2                           amd64        Boost C++ Libraries development files (ALL) (default version)

也就是说我的boost版本是1.83。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions