Answer the question
In order to leave comments, you need to log in
Why does the compiler throw a "not a type" error when using forward declaration?
Good day, toasters.
I have two header files with source code:
report.h
#ifndef __REPORT_H
#define __REPORT_H
namespace HidDevice {
class Device;
class Report {
// реализация родительского класса
};
struct SetModeReport : public Report {
public:
SendModeReport() :
Report(M_REPORT, M_REPORT_LEN),
mode(Device::Mode::UNDEFENDED)
{ };
~SendModeReport() { };
Device::Mode mode;
// остальные методы и поля
private:
// приватная область
};
}; // HidDevice namespace
#endif //__REPORT_H
#ifndef __HID_H
#define __HID_H
#include "report.h"
namespace HidDevice {
class Device
{
public:
//! List of HID device states
enum Mode {
NORMAL = 0, /*!< Mode of sending angles */
CALIB_WHEEL, /*!< Calibration wheel mode */
CALIB_RUDDER, /*!< Calibration rudder mode */
SAVE_TABLE_WHEEL, /*!< Save wheel calibration into flash memory */
SAVE_TABLE_RUDDER, /*!< Save rudder calibration into flash memory */
END_SAVE_TABLE, /*!< End of table saving */
CALC_CRC, /*!< Calculate CRC of both tables */
END_CALC_CRC, /*!< End of calculating CRC */
UNDEFENDED /*!< "Do nothing" mode */
};
void sendData(Report& report);
// другие поля и методы
};
}; // HidDevice namespace
#endif //__HID_H
inc\hid\report.h|97|error: 'Mode' in 'class HidDevice::Device' does not name a type|
namespace HidDevice {
class Device;
....
}; // HidDevice namespace
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question