lundi 5 décembre 2022

Why am I getting error: expected class-name before ‘{’ token [closed]

I have a really simple file, and I keep getting an error on it: IRequestFrame.h:20:65: error: expected class-name before ‘{’ token And I've been trying to find the problem all day, but I can;t find it. I keep checking but it looks to me that I did everything right... But computer says no.

This is the file (without the namespaces):

#ifndef SRC_POWERSOFT_KSERIES_MESSAGE_IREQUESTFRAME_H_
#define SRC_POWERSOFT_KSERIES_MESSAGE_IREQUESTFRAME_H_

#include "IFrame.h"
#include "../../serde/ISerializable.h"
#include "../packet/IRequestPacket.h"

namespace amp {
namespace kseries {
namespace message {
namespace frame {

class IRequestFrame: public IFrame, public amp::kseries::serde::ISerializable {
                                                                           // ^ position of error
public:
    virtual std::size_t serializeTo(char* const buffer, std::size_t buff_size) = 0;
    virtual packet::IRequestPacket* getPacket() const = 0;
    virtual ~IRequestFrame();
};

} // frame
} // message
} /* namespace kseries */
} /* namespace amp */

#endif /* SRC_POWERSOFT_KSERIES_MESSAGE_IREQUESTFRAME_H_ */

These are the includes:

IFrame.h

#ifndef SRC_POWERSOFT_KSERIES_MESSAGE_IFRAME_H_
#define SRC_POWERSOFT_KSERIES_MESSAGE_IFRAME_H_
#include "../packet/IPacket.h"

namespace amp {
namespace kseries {
namespace message {
namespace frame {

class IFrame {
public:
    virtual unsigned int getAddress() const = 0;
    virtual ~IFrame();
};

} // frame
} // message
} /* namespace kseries */
} /* namespace amp */

#endif /* SRC_POWERSOFT_KSERIES_MESSAGE_IFRAME_H_ */

ISerializable .h

#ifndef SRC_POWERSOFT_KSERIES_SERDE_ISERIALIZABLE_H_
#define SRC_POWERSOFT_KSERIES_SERDE_ISERIALIZABLE_H_
#include <cstddef>
#include <vector>

namespace amp {
namespace serde {

class ISerializable {
protected:
    static std::vector<char> intToChars(int input, int base, int size);
public:
    virtual std::size_t serializeTo(char* const buffer, std::size_t buff_size) = 0;
    virtual ~ISerializable();
};

} /* namespace serde */
} /* namespace amp */

#endif /* SRC_POWERSOFT_KSERIES_SERDE_ISERIALIZABLE_H_ */

IRequestPacket.h (This one is more for completeness, but I guess it isn't part of the problem

#ifndef SRC_POWERSOFT_KSERIES_MESSAGE_PACKET_IREQUESTPACKET_H_
#define SRC_POWERSOFT_KSERIES_MESSAGE_PACKET_IREQUESTPACKET_H_

#include "IPacket.h"
#include "../payload/IRequestPayload.h"
#include "../../serde/ISerializable.h"

namespace amp {
namespace kseries {
namespace message {
namespace packet {

class IRequestPacket: public IPacket, public serde::ISerializable {
public:
    virtual payload::IRequestPayload* getPayload() = 0;
    virtual ~IRequestPacket();
};

} /* namespace packet */
} /* namespace message */
} /* namespace kseries */
} /* namespace amp */

#endif /* SRC_POWERSOFT_KSERIES_MESSAGE_PACKET_IREQUESTPACKET_H_ */

Aucun commentaire:

Enregistrer un commentaire