ns-3模拟中的错误

Error in a ns-3 simulation?

本文关键字:错误 模拟 ns-3      更新时间:2023-10-16

我正在尝试运行模拟,但一直遇到一些错误。我不是C++方面的专家,但我认为这是因为包含了头文件。我得到以下错误:

error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
 void OutInterest(Ptr<const ns3::ndn::InterestHeader> interestHeader,Ptr<const ns3::ndn::Face> face) {
                            ^
../scratch/vndn_simulation.cc:87:52: error: template argument 1 is invalid
 void OutInterest(Ptr<const ns3::ndn::InterestHeader> interestHeader,Ptr<const ns3::ndn::Face> face) {
                                                    ^
../scratch/vndn_simulation.cc:87:28: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
 void OutInterest(Ptr<const ns3::ndn::InterestHeader> interestHeader,Ptr<const ns3::ndn::Face> face) {

你知道如何解决这个错误吗?

这里说:

class NameComponents;
       ^
In file included from ./ns3/ndn-v2v-net-device-face.h:31:0,
                 from ../scratch/vndn_simulation.cc:15:
./ns3/ndn-header-helper.h:34:21: note: ‘ns3::ndn::NameComponents’ has a previous declaration here
        typedef Name NameComponents;
                     ^

不能正向声明NameComponents,因为编译器已经看到它是typedef而不是类。