我已经对对象使用了上百次向量,但现在它似乎不想对它们做任何事情。我一直收到一个编译错误“模板类型参数的模板实参必须是一个类型”:
请注意,我使用的是开放框架
#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的头文件:
#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“文件中包含的,该文件来自于开放框架库
发布于 2012-10-02 08:06:01
你永远不会在你的头中使用#include <vector>。因此,std::vector不是已知类型。
发布于 2012-10-02 08:09:36
包括vector.h
#include <vector>https://stackoverflow.com/questions/12682792
复制相似问题