Somewhat new to c++, attempting to create classes/functions to make my future code clean. I am using Code::Blocks to create my program and at the moment receiving the above message for the following cpp and header files for disctype, ripmusic and dvdmanip. The compiler is gcc and this is not the main program.

The header file:

#ifndef MUSIC_H
#define MUSIC_H
using namespace std;

class media
{
public:
    media();
    virtual ~media();

protected:
    string detectdisc;
private:

};

class disctype: public media
{
public:
    disctype();
};

class ripmusic: public media
{
public:
    ripmusic();
};

class dvdmanip: public media
{
public:
    dvdmanip();
};

#endif // MUSIC_H

The cpp file:

#include "media.h"

//using namespace std;
media::media()
{
//ctor
}

media::~media()
{
//dtor
}

void media::disctype()
{
    do
        detectdisc= system(cdde -b)
    while detectdisc != ""

    if (detectdisc == "An audio cd was inserted.")
    {
        ripmusic();
    }
    else if (detectdisc == "A dvd was inserted.")
    {
        dvdmanip();
    }
}

void media::ripmusic()
{
    musicrip.hidden=false
}

void media::dvdmanip()
{
    //musicrip.hidden=false
}
3

There are 3 best solutions below

0
On

The error messages tells you that you don't have the specified member methods in media (particulary media does not contain the members ripmusic(), dvdmanip() anddisctype()` which you try to define later. You member definitions need to be changed to:

void disctype::disctype(){...}
void ripmusic::ripmusic(){...}
void dvdmanip::dvdmanip(){...}
0
On

You are using inherits classes like a methods.

disctype();
ripmusic()
dvdmanip()

are declared like a classes, so you can't write

 void media::dvdmanip() {} etc...
0
On

Define your functions as members of the media class.

Change your header file to:

#ifndef MUSIC_H
#define MUSIC_H
using namespace std;

class media
{
public:
    media();
    virtual ~media();
    void disctype();
    void ripmusic();
    void dvdmanip();

protected:
    string detectdisc;
private:

};