#ifndef CLASS_VEHICLE_
#define CLASS_VEHICLE_
#include "ns3/ptr.h"
#include "ns3/object.h"
#include "ns3/vector.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/wifi-module.h"
#include "Cluster.h"
namespace ns3
{
class Cluster;
/// define type DeviceTraceCallback
typedef Callback<void, Ptr<Vehicle>, std::string, Ptr<const Packet> > DeviceTraceCallback; // Line where the error is
/// define type VehicleReceiveCallback.
typedef Callback<void, Ptr<Vehicle>, Ptr<const Packet>, Address> VehicleReceiveCallback;
/// define type PhyRxOkTraceCallback.
typedef Callback<void, Ptr<Vehicle>, std::string, Ptr<const Packet>, double, WifiMode, enum WifiPreamble> PhyRxOkTraceCallback;
/// define type PhyRxErrorTraceCallback.
typedef Callback<void, Ptr<Vehicle>, std::string, Ptr<const Packet>, double> PhyRxErrorTraceCallback;
/// define type PhyTxTraceCallback.
typedef Callback<void, Ptr<Vehicle>, std::string, Ptr<const Packet>, WifiMode, WifiPreamble, uint8_t> PhyTxTraceCallback;
/// define type PhyStateTraceCallback.
typedef Callback<void, Ptr<Vehicle>, std::string, Time, Time, enum WifiPhy::State> PhyStateTraceCallback;
class Vehicle : public ns3::Object
{
... code section
};
};
#endif
我正在ns3上,我必須實現一個代碼,可以讓我做一些關於車載網絡的模擬。我有幾個班,但只有一個很煩人。事實上,我編譯時有此特定錯誤:錯誤:無效的聲明之前與typedef
"/src/vanet/model/Vehicle.h:45: error: invalid declarator before ‘DeviceTraceCallback’"
,它帶來了噸其他錯誤,
"/src/vanet/model/Vehicle.h:212: error: ‘DeviceTraceCallback’ does not name a type"
或
"../src/vanet/model/Vehicle.h:214: error: ‘DeviceTraceCallback’ has not been declared".
我真的不明白我做錯了什麼,所以如果有人能幫助我,這將是非常好的!
歡迎來到StackOverflow!請閱讀常見問題解答並提供一個最小的,可編輯的例子(即使用所有'#includes')來顯示問題。 – TemplateRex 2012-08-09 14:41:13
請嘗試將該代碼編輯到_minimum_重現問題 - 只需刪除壞聲明後的所有內容,並刪除它之前的所有內容,而不會引入新錯誤。對於其他人而言,讀取_relevant_代碼時不會受到與該問題相關的代碼的困擾。作爲獎勵,您有時可以在此過程中自己解決問題。 – Useless 2012-08-09 14:41:34
好吧,我這樣做;) – Demyke 2012-08-09 14:46:22