Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:55:06+00:00 2026-06-09T12:55:06+00:00

#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

  • 0
#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

I am working on ns3, and I’ve to implement a code which could let me do some simulations about vehicular networks. I have several classes, but only one is annoying. Indeed when I compile I have this particular error:

“/src/vanet/model/Vehicle.h:45: error: invalid declarator before ‘DeviceTraceCallback’”

and it brings a tons other errors as

“/src/vanet/model/Vehicle.h:212: error: ‘DeviceTraceCallback’ does not name a type”

or

“../src/vanet/model/Vehicle.h:214: error: ‘DeviceTraceCallback’ has not been declared”.

I really don’t understand what I did wrong, so if someone could help me it would be very nice!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:55:08+00:00Added an answer on June 9, 2026 at 12:55 pm

    You haven’t shown us which source line the error refers to, but I’ll assume it’s this one:

    typedef Callback<void, Ptr<Vehicle>, std::string, Ptr<const Packet> > DeviceTraceCallback; 
    

    Have all the types and templates mentioned in that line been declared in one of the headers you’ve included? In particular:

    • You haven’t directly included <string>. It’s a good idea to do that, even if one of the other headers might include it indirectly.
    • You haven’t declared the Vehicle type, defined later in this file. You’ll need a declaration (class Vehicle; inside namespace ns {}) before you can use it in this declaration.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class: #ifndef CGE_NET_MESSAGE_PARSER_HPP #define CGE_NET_MESSAGE_PARSER_HPP #include Game/platform.hpp #include <vector> #include
I have the following class #ifndef Container_H #define Container_H #include <iostream> using namespace std;
The class corresponding to this crash is: #ifndef IMAGE_DATA_ #define IMAGE_DATA_ #include <stdexcept> template
#ifndef C_H #define C_H #include <memory> class C { public: C(){}; ~C() {}; };
I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream>
FILE #1 (foo.h): #ifndef FOO_H_ #define FOO_H_ #include baseclass.h #include bar.h class Bar; class
#ifndef MACROS_NULLCHECK_H_ #define MACROS_NULLCHECK_H_ #include <assert.h> #define NULLCHECK(x) assert(x != (void *) 0); #endif
What is your opinion about my code ? #ifndef PROTOTYPE_H #define PROTOTYPE_H #include <map>
File ex1.hpp (definition of template class): #ifndef EX1_HPP #define EX1_HPP #include ex2.hpp template <class
I have this definition for my Test class: #ifndef TEST_H #define TEST_H #include <iostream>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.