问题标签 [incomplete-type]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - 在该类中创建类数组
我正在尝试在 C++ 中添加 QuadTree。到目前为止我有这个代码:
但我收到一个错误“错误:不允许不完整的类型”。我究竟做错了什么?
c++ - QWebElement 具有初始化程序但类型不完整
每当我运行此代码时,我都会收到一条错误消息
QWebElement has initializer but has incomplete type
我没有填写此错误的含义,因此非常感谢任何帮助
c++ - 在集合中使用嵌套类时出现不完整的类型错误
我正在将一些 Java 代码翻译成 C++。当我尝试编写如下代码时:
。H:
.cpp:
我收到了不完整的类型错误。我知道这是因为嵌套类在b_set
. 但是解决它的最佳方法是什么?
c++ - 模板代码中的类型不完整
假设我们有两种类型(完整和不完整):
我们还有模板代码:
T
can be CompleteType
or IncompleteType
here and X(T)
can be T
, decltype(T())
or decltype(T{})
(假设X(T)
是宏)。
此代码以下列方式使用:
您可以在下面看到不同的编译器如何处理此类代码:
铿锵声3.4
error: invalid use of incomplete type 'IncompleteType'
即使在没有在代码中使用的情况下,即使在具有不完整类型的模板类声明(对于decltype(T())
anddecltype(T{})
,但不是对于 simpleT
)的模板类声明中也会给出。Test<>::value
error: too few template arguments for class template 'Test'
g++ 4.8.1
vc++ 18.00.21005.1
error C2514: 'IncompleteType' : class has no constructors
error C2440: '<function-style-cast>' : cannot convert from 'initializer-list' to 'IncompleteType' Source or target has incomplete type
什么编译器符合标准?请注意,简单的字符串 likestd::cout << typeid(X(IncompleteType)).name() << std::endl;
不会在所有编译器上编译X
(除了vc++ 和 X(T) == T
)的所有变体。
c - C - 取消引用指向不完整类型的指针 - 将字符串插入二叉搜索树
我在第 58 行得到一个指向不完整类型的解引用指针:rootNode->_left = NULL。有任何想法吗?
还有很多代码被注释掉以挑出这个错误,但我对这个 ADT 的格式还有另一个问题:通常的二叉搜索树结构只有一个 Node 类和所有 BST 函数,如 insert take 和返回一个节点。然而,在这里我必须使用一个单独的树结构,它的根是另一个结构 TNode。这对我来说一直是个问题,例如在 addStringToTree 函数中它只返回并采用 Tree 参数。所以我不知道如何以通常的方式使用节点进行递归。我创建了一个辅助函数作为我的解决方案,但不确定这是否理想。
第二次编辑
哇,只是一个愚蠢的错字。多谢你们。TNode 的 _key 变量也应该是 char* 类型而不是 struct TNode* 类型
c - 不允许不完整的类型
我正在尝试通过将内存分配给指向队列的指针来创建队列,但是当我在 size 插槽中写入结构的名称时出现此错误。我真的不知道如何解释这个,所以代码:
结构,在 queue.c 中定义:
队列.h:
队列的用法,在funcs.c中:
将鼠标悬停struct
在sizeof()
参数中时会显示错误。我到底做错了什么?我记得过去做过类似的事情,而且效果很好。我相信它可能与节点中的 void 指针有关,但我该如何解决呢?
c - 与 C 中的 Int 数组不兼容的类型
我刚刚学习 C,并且在将数组分配给函数中的全局定义数组时遇到问题:
编译时出现错误:
从类型 'uint16_t (*)[2]' 分配给类型 'uint16_t[50][2]' 时不兼容的类型</p>
两个数组的类型和大小相同,那么为什么会出现这种情况呢?
c++ - 尽管包含标头,但 C++ 成员访问不完整类型
我在使用转发声明时遇到了一个奇怪的问题。这是代码:
Torse 类,torse.hpp
在 torse.cpp 中:
现在在动画类中,animation.hpp
在动画.cpp 中:
如您所见,我正在共享枚举 frame_type 以及 Anmation 和 Torse 类,但我觉得我做得对,就像在 animation.cpp 中一样,由于 torse.hpp,它应该知道 torse 是如何...
clang 给了我这个错误:
有人有线索吗?
c - C: Allowed to assign any array to pointer to array of incomplete type
The following seems of questionable legality in C89. I can't figure out why it's allowed. I'm reading the standard and my copy of K&R2 and I still don't get it.
That's it really. I need a quote from the C89 standard that tells me why this is permitted. This is not a C++ question, it's definitely illegal there. Thanks!
EDIT: This explains where it comes into question in the standard: http://port70.net/~nsz/c/c89/c89-draft.html#3.3.16.1
ios - 如何修复 UICollectionViewCell 子类的不兼容指针
我已经实现了一个子类SPCell
,UICollectionViewCell
我用它来在我的UICollectionViewController
. 现在,当我收集一个单元格时,为了对其进行处理,我收到了一个警告Incompatible pointer types initializing 'SPCell *' with an expression of type 'UICollectionViewCell *'
这是一个例子。我的自定义单元格包含一个图像,我想更改它的 alpha 值。但是在我分配单元格的行中,我收到了这个警告。
提前致谢。