小编use*_*372的帖子

分配抽象类类型错误的对象

嗨,我收到以下错误,我真的不确定为什么.

class InteSiVis: public ofBaseApp //{
,  public ofxMidiListener{
Run Code Online (Sandbox Code Playgroud)

当我从ofxMidiListener类继承类inresivis并且在主源文件中出现以下错误时会发生这种情况

int main(){

ofSetupOpenGL(1920,1080, OF_WINDOW);            
ofRunApp( new InteSiVis()); // <-------- The error is here Allocating object of type abstract
Run Code Online (Sandbox Code Playgroud)

}

这真的令人困惑,因为我已经用另一个例子以确切的方式尝试了这个并且没有得到这个错误.

class testApp : public ofBaseApp, public ofxMidiListener {

int main(){
    ofSetupOpenGL(640, 480, OF_WINDOW);
    ofRunApp(new testApp());
}
Run Code Online (Sandbox Code Playgroud)

你能不能给我一个想法,为什么我得到这个错误我正在以完全相同的方式调用这个类.提前致谢.

/// ----------------------------------编辑InteSiVis.h

class InteSiVis: public ofBaseApp //{
,  public ofxMidiListener{

public:
    InteSiVis() ;

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

    void keyPressed(int key);
    void keyReleased(int key);

    // Make an Array of Particle …
Run Code Online (Sandbox Code Playgroud)

c++ abstract-class

14
推荐指数
1
解决办法
4万
查看次数

标签 统计

abstract-class ×1

c++ ×1