gpt4 book ai didi

c++ - 解决一个困难的不完整类型错误

转载 作者:搜寻专家 更新时间:2023-10-31 01:59:56 25 4
gpt4 key购买 nike

我在尝试编译我的代码时遇到类型不完整的错误。我知道它与包含有关,但是我的项目很大并且它使用了几个模板所以我找不到哪个类型实际上是不完整的。错误消息也无济于事:

Compiling: ../../../addons/ofxTableGestures/src/Graphics/objects/CursorFeedback.cpp
In file included from ../../../addons/ofxTableGestures/ext/boost/fusion/include/invoke_procedure.hpp:10,
from ../../../addons/ofxTableGestures/src/oscGestures/tuioApp.hpp:46,
from /home/thechaos/Projectes/of_preRelease_v0061_linux_FAT/addons/../apps/OF-TangibleFramework/ofxTableGestures/src/Graphics/objects/CursorFeedback.hpp:35,
from /home/thechaos/Projectes/of_preRelease_v0061_linux_FAT/addons/../apps/OF-TangibleFramework/ofxTableGestures/src/Graphics/objects/CursorFeedback.cpp:31:
../../../addons/ofxTableGestures/ext/boost/fusion/functional/invocation/invoke_procedure.hpp: In function ‘void boost::fusion::invoke_procedure(Function, const Sequence&) [with Function = void (tuio::CanBasicFingers<Graphic>::*)(long int, float, float, float, float, float), Sequence = boost::fusion::joint_view<boost::fusion::joint_view<boost::fusion::iterator_range<boost::fusion::vector_iterator<const boost::fusion::vector6<long int, float, float, float, float, float>, 0>, boost::fusion::vector_iterator<boost::fusion::vector6<long int, float, float, float, float, float>, 0> >, const boost::fusion::single_view<tuio::CanBasicFingers<Graphic>*> >, boost::fusion::iterator_range<boost::fusion::vector_iterator<boost::fusion::vector6<long int, float, float, float, float, float>, 0>, boost::fusion::vector_iterator<const boost::fusion::vector6<long int, float, float, float, float, float>, 6> > >]’:
../../../addons/ofxTableGestures/src/oscGestures/tuioApp.hpp:122: instantiated from ‘void tuio::AlternateCallback<C, M, E>::run(tuio::TEvent*) [with C = tuio::CanBasicFingers<Graphic>, M = void (tuio::CanBasicFingers<Graphic>::*)(long int, float, float, float, float, float), E = tuio::TeventBasicFingersMoveFinger]’
/home/thechaos/Projectes/of_preRelease_v0061_linux_FAT/addons/../apps/OF-TangibleFramework/ofxTableGestures/src/Graphics/objects/CursorFeedback.cpp:64: instantiated from here
../../../addons/ofxTableGestures/ext/boost/fusion/functional/invocation/invoke_procedure.hpp:88: error: incomplete type ‘boost::fusion::detail::invoke_procedure_impl<void (tuio::CanBasicFingers<Graphic>::*)(long int, float, float, float, float, float), const boost::fusion::joint_view<boost::fusion::joint_view<boost::fusion::iterator_range<boost::fusion::vector_iterator<const boost::fusion::vector6<long int, float, float, float, float, float>, 0>, boost::fusion::vector_iterator<boost::fusion::vector6<long int, float, float, float, float, float>, 0> >, const boost::fusion::single_view<tuio::CanBasicFingers<Graphic>*> >, boost::fusion::iterator_range<boost::fusion::vector_iterator<boost::fusion::vector6<long int, float, float, float, float, float>, 0>, boost::fusion::vector_iterator<const boost::fusion::vector6<long int, float, float, float, float, float>, 6> > >, 7, true, false>’ used in nested name specifier

如果我将冲突代码复制到同一个文件中,我可以编译它。所以我知道代码本身没问题,问题是我实例化它的方式。

如何追踪此错误的来源?有什么方法可以获取 c++ 编译器和预处理器的踪迹以获得更多信息性消息?

编辑:我使用的是 gcc 4.4.1

最佳答案

如果你给我们编译器会更容易。

gcc 上,您可以使用 -E 选项查看预处理文件。如果您尝试编译预处理文件,它应该更容易诊断。此外,您会确切地看到所涉及的类型。

至于具体的错误,最后一行一般是指示性的:

boost::fusion::detail::invoke_procedure_impl<
void (tuio::CanBasicFingers<Graphic>::*)
(long int, float, float, float, float, float),
const boost::fusion::joint_view<

boost::fusion::joint_view<
boost::fusion::iterator_range<
boost::fusion::vector_iterator<
const boost::fusion::vector6<long int, float, float, float, float,
float>,
0
>,
boost::fusion::vector_iterator<
boost::fusion::vector6<long int, float, float, float, float, float>,
0
>
>,
const boost::fusion::single_view< tuio::CanBasicFingers<Graphic>* >
>, // joint_view

boost::fusion::iterator_range<
boost::fusion::vector_iterator<
boost::fusion::vector6<long int, float, float, float, float, float>, 0
>,
boost::fusion::vector_iterator<
const boost::fusion::vector6<long int, float, float, float, float,
float>,
6
>
> // iterator_range

>,
7,
true,
false
>

好的,所以重新格式化在这里有点帮助。

你似乎有一个命名空间 tuio,它应该包含一个模板类 CanBasicFingers,你想使用它的 Graphic 实例化并获取指向成员函数的指针。

假设您已经正确地包含了所有 Boost.Fusion,很可能是 CanBasicFingersGraphic 没有被正确包含。<​​/p>

否则,在迭代器的常量性中查找混合:每个范围都是用一个常量和一个非常奇怪的非常量迭代器定义的。

您应该尝试分别调用它们。

作为诊断的一般技术,我只能推荐分而治之方法。您应该尝试一点一点地构建表达式:

namespace fusion = boost::fusion;

// First
typedef void (tuio::CanBasicFingers<Graphic>::* function_t)
(long int, float, float, float, float, float);

// Second
typedef fusion::vector6<long int, float, float, float, float, float> vector_t;

// Third: the iterators
typedef fusion::vector_iterator< const vector_t, 0 > const_iterator_begin;
typedef fusion::vector_iterator< const vector_t, 6 > const_iterator_end;

typedef fusion::vector_iterator< vector_t, 0 > iterator_begin;
typedef fusion::vector_iterator< vector_t, 6 > iterator_end;

// Fourth: the ranges
// (which const-ness are oddly messed up)
typedef fusion::iterator_range< const_iterator_begin, iterator_end > range_1;
typedef fusion::iterator_range< iterator_begin, const_iterator_end > range_2;

// Fifth the views
typedef const fusion::single_view<tuio::CanBasicFingers<Graphic>*> single_view;
typedef fusion::joint_view< range_1, single_view > joint_view_internal;
typedef fusion::joint_view< joint_view_internal, range_2 > joint_view_external;

// and here is the final type (aaaah!)
typedef fusion::detail::invoke_procedure_impl<
function_t,
joint_view_external,
7,
true,
false
> procedure_type;

编译这个分解的表格,应该会在更精确的位置产生错误:)

关于c++ - 解决一个困难的不完整类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2539856/

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