#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