Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;尽管包含标头,但成员对不完整类型的访问仍不完整_C++_Declaration_Member_Forward_Incomplete Type - Fatal编程技术网

C++ C++;尽管包含标头,但成员对不完整类型的访问仍不完整

C++ C++;尽管包含标头,但成员对不完整类型的访问仍不完整,c++,declaration,member,forward,incomplete-type,C++,Declaration,Member,Forward,Incomplete Type,我在使用转发声明时遇到了一个奇怪的问题。代码如下: Torse类,Torse.hpp #ifndef _TORSE_ #define _TORSE_ class Animation; enum frame_type; class Torse : public Renderable { public: const glm::vec3& getCurrentRotation(frame_type); }; #endif 在torse.cpp中: #include "torse.hpp"

我在使用转发声明时遇到了一个奇怪的问题。代码如下:

Torse类,Torse.hpp

#ifndef _TORSE_
#define _TORSE_

class Animation;
enum frame_type;

class Torse : public Renderable
{
public:
const glm::vec3& getCurrentRotation(frame_type);
};
#endif
在torse.cpp中:

#include "torse.hpp"
#include "animation.hpp"
const glm::vec3& Torse::getCurrentRotation(frame_type t)
{...}
现在在动画课上,Animation.hpp

#ifndef __ANIMATION_H__
#define __ANIMATION_H__

class torse;

class frame {...};
class Animation {

public:
void generateInterpolation(torse& me);
};
#endif
在animation.cpp中:

#include "animation.hpp"
#include "torse.hpp"
void Animation::generateInterpolation(torse &me)
{
...
f1.rot[j] = me.getCurrentRotation(f1.type)[j];
...
}
正如你所看到的,我正在共享enum frame_类型以及Anmation和Torse类,但我觉得我做得不错,就像在animation.cpp中一样,它应该知道Torse是如何感谢Torse.hpp

叮当声给了我这个错误:

src/animation.cpp:19:43: error: member access into incomplete type 'torse'
                            f1.rot[j] = me.getCurrentRotation(f1.type)[j];
                                        ^

有人有线索吗?

您定义了一个类型
Torse
,但clang抱怨了一个名为
Torse
的类型


解决您的问题。

您使用的是。在类定义下,您从animation.cpp中漏掉了一个“#”,从torse.hpp中漏掉了一个“l”(小写l),请将“public”更改为“public”,其中定义了
可渲染的
Torse
继承自它,但我看不到包含。你是说
me
吗?@Posva ok,但现在我看到你定义了一个classe
Torse
,然后你在动画函数中使用
Torse
。。。