首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对象的向量无法编译

对象的向量无法编译
EN

Stack Overflow用户
提问于 2012-10-02 08:03:54
回答 2查看 134关注 0票数 2

我已经对对象使用了上百次向量,但现在它似乎不想对它们做任何事情。我一直收到一个编译错误“模板类型参数的模板实参必须是一个类型”:

请注意,我使用的是开放框架

代码语言:javascript
复制
#pragma once

#include "ofMain.h"
#include "cLine.h"

using namespace std;

class testApp : public ofBaseApp{
    public:

        vector < cLine > lines; // Here is the vector of type cLine

        void setup();
        void update();
        void draw();

        void keyPressed(int key);
        void keyReleased(int key);
        void mouseMoved(int x, int y);
        void mouseDragged(int x, int y, int button);
        void mousePressed(int x, int y, int button);
        void mouseReleased(int x, int y, int button);
        void windowResized(int w, int h);
        void dragEvent(ofDragInfo dragInfo);
        void gotMessage(ofMessage msg);
};

和cLine的头文件:

代码语言:javascript
复制
#ifndef aftermotion_cLine_h
#define aftermotion_cLine_h

#include <iostream>
#include "ofMain.h"

class cLine
{
public:

    int y;
    float thickness;

    cLine();
    cLine(const cLine &);
    cLine(float thinkness);

    void draw();
    void update();

};

#endif

编辑:我尝试过#include,它没有改变任何东西,因为它已经是sdt库的一部分,而sdt库本身是从"ofMain.h“文件中包含的,该文件来自于开放框架库

EN

回答 2

Stack Overflow用户

发布于 2012-10-02 08:06:01

你永远不会在你的头中使用#include <vector>。因此,std::vector不是已知类型。

票数 3
EN

Stack Overflow用户

发布于 2012-10-02 08:09:36

包括vector.h

代码语言:javascript
复制
#include <vector>
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12682792

复制
相关文章

相似问题

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