首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“SceneElement”未在此范围内声明

“SceneElement”未在此范围内声明
EN

Stack Overflow用户
提问于 2019-07-21 08:15:54
回答 1查看 669关注 0票数 0

我想在我的3d查看器中使用选择,我尝试了这个例子,但是我遇到了以下问题:

错误:“SceneElement”未在此作用域QList sceneElements中声明;

scene.h文件:

代码语言:javascript
复制
#ifndef SCENE_H
#define SCENE_H
 #include <sceneelement.h>
#include <QGLViewer/qglviewer.h>

class Scene
{

private:
    /// The list of elements that make up the scene

 QList <SceneElement*> sceneElements ;

public:
     Scene();
    /// Creates a scene with RenderElements positionned on a regular grid.
    /// Consider increasing selectBufferSize() if you use more RenderElements.

    void draw();
    void setSelected(int i);
    void drawWithNames();
void clearSelection();
};

sceneelement.h文件:

代码语言:javascript
复制
#include <QGLViewer/qglviewer.h>
#include <viewer.h>

class SceneElement
{

    friend class Scene;
private:

    qglviewer::Frame frame;
    bool isSelected;


public:
    /// Constructor
    SceneElement(float x, float y){
        isSelected=false;
        qglviewer::Vec pos(x,y,0.0);
        frame.setPosition(pos);
    }
    /// Draws this element
    void draw() const;

};

我不知道为什么它不能使用SceneElement,虽然我包括了

我很感谢你的帮助,谢谢。

EN

回答 1

Stack Overflow用户

发布于 2019-07-22 08:11:11

这个建议解决了我的问题,看起来你有一个循环依赖关系。尝试在scene.h - Romha Korev中的行类场景之前添加一个前向声明类SceneElement。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57131468

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档