我是 openFrameworks/C++ 的新手,但使用 Processing/Java 已经有一段时间了。我无法实例化我在 testApp 标头中创建的类的对象。
它抛出错误:
Implicit default constructor for 'testApp' must explicitly initialize the member 'currentSeq' which does not have a default constructor.
这是我的 Sequence.h 文件:
#pragma once
#include "ofMain.h"
class Sequence{
public:
Sequence(long _start, long _stop){
start = _start;
stop = _stop;
}
long start;
long stop;
};
这是我的 testApp.h:
#pragma once
#include "ofMain.h"
#include "sequence.h"
class testApp : public ofBaseApp{
public:
void setSequences();
bool needsNewSeq();
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);
int numSequences;
int seqIndex;
bool isPaused;
Sequence currentSeq;
vector <Sequence> sequences;
ofVideoPlayer myVideo;
};
问题是currentSeq
变量。不过,由于某种原因,序列的向量很好。根据这个openFrameworks 教程,我似乎做的一切都是正确的。