{ 标记之前的预期类名

Expected class name before { token

本文关键字:      更新时间:2023-10-16

这是两个头文件。孩子和父母。谁能解释为什么会发生此错误?

提前致谢

SampleApplication.h:

#ifndef SAMPLEAPPLICATION_H_
#define SAMPLEAPPLICATION_H_
#include "ns3/CcnModule.h"
#include "ns3/CCN_Name.h"
#include <string>
class CcnModule;
class SampleApplication : public ns3::Application
{
   public:
    ns3::Ptr<CcnModule> ccnm;

    static ns3::TypeId GetTypeId(void);
    virtual ns3::TypeId GetInstanceTypeId (void) const;
    SampleApplication();
    SampleApplication(ns3::Ptr<CcnModule> ccnm);
    virtual ~SampleApplication();
    char* data;
    int length;
    ns3::Ptr<CCN_Name> dataName;
    void SendInterest(ns3::Ptr<CCN_Name> n);
    void SendData(ns3::Ptr<CCN_Name> data, char* buff, int bufflen);
    virtual void InterestReceived(ns3::Ptr<CCN_Name> ccnn);
    virtual void DataArrived(ns3::Ptr<CCN_Name> data, char* buff, int bufflen);
    void AnnounceName(ns3::Ptr<CCN_Name> n);
    virtual void DoDispose();
    virtual void DoInitialize();
};
#endif

接收器.h:

#ifndef RECEIVER_H_
#define RECEIVER_H_

#include "ns3/CcnModule.h"
#include "ns3/CCN_Name.h"
#include <string>
#include <vector>
#include "ns3/SampleApplication.h"

class CcnModule;
//class SampleApplication;
class Receiver : SampleApplication
{
   public:
    static ns3::TypeId GetTypeId(void);
    virtual ns3::TypeId GetInstanceTypeId (void) const;
    Receiver(ns3::Ptr<CcnModule> ccnm);
    virtual ~Receiver();
    void SendInterest(ns3::Ptr<CCN_Name> n);
    virtual void DataArrived(ns3::Ptr<CCN_Name> data, char* buff, int bufflen);
};
#endif
我不

熟悉您使用的库,但我猜它是 NS-3 离散事件网络模拟器,粗略浏览一下 API,我希望看到包含

#include "ns3/application.h"

在您的 SampleApplication.h 文件中。

很可能它已经被您的实现中的其他一些包含拉入,但乍一看它似乎丢失了。

相关文章:
  • 没有找到相关文章