gpt4 book ai didi

c++ - OpenVDB 错误 : Q_FOREACH passed 3 arguments, 但只需要 2

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

我刚刚安装了 OpenVDB,我正在尝试编译来自 here 的基本示例(Ubuntu 14.04 + QtCreator 3.4.0 + GCC_64)。前两个例子工作得很好,但第三个例子不行——一旦我包含“LevelSetSphere.h”,它就会给出一堆错误。最常见的错误是“Q_FOREACH passed 3 arguments, but takes just 2”并引用代码

void foreach(const NodeOp& op, bool threaded = true, size_t grainSize=1)
{
NodeTransformer<NodeOp> transform(op);
transform.run(this->nodeRange(grainSize), threaded);
}

在 NodeManager.h 中(其他错误指的是 OpenVDB 不同文件中的不同代码块)。有人知道我做错了什么吗?

最佳答案

要 union 使用 QT 和 OpenVDB,只需在包含 openvdb.h 之前使用以下预处理器指令:

#ifdef foreach
#undef foreach
#endif
#include <openvdb/openvdb.h>

//[...] here foreach is defined by openvdb and there is no foreach QT macro

使用此解决方案时,您不能使用 QT foreach 宏。您仍然可以使用 ranged based for如果你使用的是 C++11

关于c++ - OpenVDB 错误 : Q_FOREACH passed 3 arguments, 但只需要 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29836558/

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