Arthur Dent
Arthur Dent

Reputation: 23

Expected class-name before '{' token

When trying to compile my project this header file (Bobjr) code::blocks gives me the error Expected class-name before '{' token. What is wrong with this code?

#ifndef BOBJR_H
#define BOBJR_H


class Bobjr: public Bob
{
    public:
        Bobjr();
};

#endif // BOBJR_H

This is the Bobjr cpp:

#include "Bobjr.h"
#include "Bob.h"
#include <iostream>

Bobjr::Bobjr()
{
    //ctor
}

Upvotes: 1

Views: 1167

Answers (1)

simonc
simonc

Reputation: 42165

You're missing a definition for Bob. You either need it in the same header of you need to #include the header that declares Bob before declaring Bobjr

Upvotes: 4

Related Questions