“does not name a type” error c++ [duplicate]

You can avoid a circular include problem by using a forward declaration of a class instead of an #include:

#ifndef ENTRANCE_H
#define ENTRANCE_H
#include <vector>
#include "Diodio.h"

class Segment;    

class Entrance
{
    public:
        Entrance();
        ~Entrance();
        void operate();


    protected:
        Segment *givesEntryTo;
        std::vector<Diodio> elBooths;
            std::vector<Diodio> manBooths;

    private:
};

#endif // ENTRANCE_H

(Entrance.cpp may or may not need to #include "Segment.H" then.)

Leave a Comment