2012-02-12 34 views
0
我無法解密從克這些錯誤消息++

C++:變量 'NS3 :: Ipv4RoutingTableEntry路線' 具有初始化但不完全的類型

../upenn-cis553/ls-routing-protocol/ls-routing-protocol.cc:533:29: error: variable ‘ns3::Ipv4RoutingTableEntry route’ has initializer but incomplete type 
../upenn-cis553/ls-routing-protocol/ls-routing-protocol.cc:533:64: error: invalid use of incomplete type ‘struct ns3::Ipv4RoutingTableEntry’ 

這裏

我的LS-路由-protocol.h文件:

#include "ns3/ipv4.h" 
#include "ns3/ipv4-routing-protocol.h" 
#include "ns3/ipv4-static-routing.h" 
#include "ns3/object.h" 
#include "ns3/packet.h" 
#include "ns3/node.h" 
#include "ns3/socket.h" 
#include "ns3/timer.h" 

#include "ns3/ping-request.h" 
#include "ns3/penn-routing-protocol.h" 
#include "ns3/ls-message.h" 

#include <vector> 
#include <map> 

... 

private: 
    ... 
    Ptr<Ipv4StaticRouting> m_staticRouting; 
    ... 

這裏從ls-routing-protocol.cc文件中的相關片段:

#include "ns3/ls-routing-protocol.h" 
#include "ns3/socket-factory.h" 
#include "ns3/udp-socket-factory.h" 
#include "ns3/simulator.h" 
#include "ns3/log.h" 
#include "ns3/random-variable.h" 
#include "ns3/inet-socket-address.h" 
#include "ns3/ipv4-header.h" 
#include "ns3/ipv4-route.h" 
#include "ns3/uinteger.h" 
#include "ns3/test-result.h" 
#include <sys/time.h> 

using namespace ns3; 


void 
LSRoutingProtocol::AuditRoutes() 
{ 
    int i; 
    int n = m_staticRouting->GetNRoutes(); 
    for (i=0; i < n; i++) 
    { 
     Ipv4RoutingTableEntry route = m_staticRouting->GetRoute(i); // ERROR 
     ... 
    } 
    ... 
} 

由於一些你可能會說,我正在與ns-3合作。我在很多地方查到了我的錯誤,大部分建議都是正確地聲明一些結構。但是,我們並沒有直接在這個代碼中使用結構(或者至少不是我所知道的)。我開始認爲這是我們使用智能指針的問題,但我並不確定。

此外,如果它的任何幫助:documentation for ipv4_static_routing.h

回答

0

你需要#include <ipv4-routing-table-entry.h>。這是您在看the documentation of ns3::Ipv4RoutingTableEntry class時看到的第一件事。

+0

哇,我完全錯過了。謝謝! (雖然,對於我們的用例,更確切的答案是'#include「ns3/ipv4-routing-table-entry.h」') – kibibyte 2012-02-12 06:25:01

相關問題