C++, undefined reference to simple class

30 Views Asked by At

I'm using Netbeans IDE8.2 of Linux. The following very simple code is not accepted:

class Instrument
{
public:
    Instrument();
    void MakeSound(){
        cout<<"Instrument plays..."<<endl;
    }
    virtual ~Instrument();
};

int main(int argc, char** argv)
{
    Instrument inst;
//    Instrument* inst = new Instrument();
    cout<<"Start"<<endl;
    
    cout<<"End"<<endl;
    return 0;
}

The compiler says: undefined reference to Instrument::Instrument() I don't know why.

0

There are 0 best solutions below