0

For some reason I keep getting "../Svc/../Drv/Timer.h:18:12: error: 'svc' has not been declared" when I compile. Can't figure out why...

Timer.h File

#include "../Svc/TimerManager.h"

namespace drv {

class Timer {
public:
    void Init(svc::TimerManager *aTimerMan);

private:
    svc::TimerManager *timerMan;

    };

} /* namespace drv */

TimerManager.h

#include <stdint.h>
#include "../Drv/Timer.h"

namespace svc {

/*
 *
 */
class TimerManager {
public:
    uint8_t msec10;
    uint8_t sec;
    uint8_t min;
    uint8_t hour;

    void Init();
    void IncrementTime();

private:
    drv::Timer timer;

};

} /* namespace svc */

1 Answers1

2

Both headers try to include each other, which is impossible.

Luckily, Timer.h doesn't do anything with TimerManager to require a complete definition; so don't include that header, just declare the class:

namespace svc {class TimerManager;}
Mike Seymour
  • 249,747
  • 28
  • 448
  • 644