Type ID is depracated

114 views
Skip to first unread message

Malik Saad

unread,
Apr 19, 2020, 6:45:44 AM4/19/20
to ns-3-users
Hello every one!

I tried to install the v2v module from the following link.


 I copied the v2v module and clustering module into the src Folder of my ns3 root. Then after running following command:

./waf configure --enable-examples

It ran sucessfully, but after this command

./waf

I got an error in v2v-control-client.cc

/src/v2v/model/v2v-control-client.cc:100:74: error: ‘ns3::TypeId ns3::TypeId::AddTraceSource(std::__cxx11::string, std::__cxx11::string, ns3::Ptr<const ns3::TraceSourceAccessor>)’ is deprecated [-Werror=deprecated-declarations]
                     MakeTraceSourceAccessor(&V2vControlClient::m_rxTrace))


How to add the attribute for this ?


Looking for the suggestions to resolve this error.
Regards
error.png

Tom Henderson

unread,
Apr 19, 2020, 11:49:10 AM4/19/20
to ns-3-...@googlegroups.com, Malik Saad

This error is due to outdated use of the AddTraceSource() method.

If you look at trace sources in recent versions of ns-3, they all have at least four parameters:

    .AddTraceSource ("RTT",
                     "Last RTT sample",
                     MakeTraceSourceAccessor (&TcpSocketBase::m_lastRttTrace),
                     "ns3::TracedValueCallback::Time")


I don't know the code you are referring to, but it must have the old variant of AddTraceSource() that had the first three parameters only.

The fourth parameter was added a while back to make it easier for our Doxygen documentation system to cross-reference the callback signature of the method that a user should pass to the trace source.

If you want to clear the error and are not concerned about Doxygen, you can simply add a fourth argument to that AddTraceSource() call, using the empty string: ""; doing so won't affect the simulation results at all.

- Tom

Malik Saad

unread,
Apr 20, 2020, 8:42:45 AM4/20/20
to ns-3-users
Thanks Tom. I resolved the issue. It was just outdated. I just added the fourth argument to that AddTraceSource() call and the issue resolved.

Many thanks.

Hiba Tamimi

unread,
Jan 8, 2022, 5:07:25 PM1/8/22
to ns-3-users
 ? Can you tell me what is the fourth argument you add  to that AddTraceSource, please
Because I am facing error message almost the same 
Screenshot from 2022-01-08 23-33-38.png

Tom Henderson

unread,
Jan 8, 2022, 6:55:54 PM1/8/22
to ns-3-...@googlegroups.com
On 1/8/22 2:07 PM, Hiba Tamimi wrote:
>  ? Can you tell me what is the fourth argument

You are replying to a very old email. Can you please restate your
question? Please note that the v2v module referred to in the original
email is not part of the mainline ns-3, and hasn't been updated since
2018, so I am not sure what possible issues may be there.

Hiba Tamimi

unread,
Jan 10, 2022, 8:51:11 AM1/10/22
to ns-3-users
Hello Tom
I tried to install the v2v module from the following link.


 I copied the v2v module and clustering module into the src Folder of my ns3 root and I do exactly as written. Then after running following command:

./waf configure --enable-examples

It ran sucessfully, but after this command

./waf

I got an error in v2v-control-client.cc

Screenshot from 2022-01-08 23-33-38.png

Tom Henderson

unread,
Jan 10, 2022, 11:43:16 AM1/10/22
to ns-3-...@googlegroups.com
On 1/10/22 5:51 AM, Hiba Tamimi wrote:
> Hello Tom
> I tried to install the v2v module from the following link.

That v2v code is out of date with the ns-3 mainline.

Specifically, TraceSources now require four arguments, such as:

// The new trace source
.AddTraceSource ("trace",
"the TraceSource",
MakeTraceSourceAccessor (&Classname::m_trace),
"ns3::TracedValueCallback::Double")

In that code base, they only have three arguments for some trace sources:

.AddTraceSource("RxLocal", "A packet has been received",
MakeTraceSourceAccessor(&V2vControlClient::m_rxTrace))

There are some other unrelated errors due to an API change in the
YansWifiPhyHelper class (it no longer has a Default() method).

We maintain a file called CHANGES.html which details the API changes
that occur from release to release, so the first place to check about
these errors and how to avoid them is in the CHANGES.html file for the
past few releases.

- Tom


>
> https://github.com/clovervnd/drone_cluster
> <https://github.com/otika/dev-coop-sys>
>
>  I copied the v2v module and clustering module into the src Folder of
> my ns3 root and I do exactly as written. Then after running following
> command:
>
> ./waf configure --enable-examples
>
> It ran sucessfully, but after this command
>
> ./waf
>
> I got an error in v2v-control-client.cc
>
> في الأحد، 9 يناير 2022 في تمام الساعة 1:55:54 ص UTC+2، كتب Tom Henderson
> رسالة نصها:
>
> On 1/8/22 2:07 PM, Hiba Tamimi wrote:
> >  ? Can you tell me what is the fourth argument
>
> You are replying to a very old email. Can you please restate your
> question? Please note that the v2v module referred to in the original
> email is not part of the mainline ns-3, and hasn't been updated since
> 2018, so I am not sure what possible issues may be there.
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/274e3b21-6d9d-433e-a40c-1d22370e9214n%40googlegroups.com
> <https://groups.google.com/d/msgid/ns-3-users/274e3b21-6d9d-433e-a40c-1d22370e9214n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Hiba Tamimi

unread,
Jan 11, 2022, 4:16:59 PM1/11/22
to ns-3-...@googlegroups.com
Dear Tom
When I made some changes on the v2v-control-client.cc file I don’t  know why all the other ns-3.35 examples want not work probably. I wonder if you have an update version of this file or you have a simple VANET cluster example. 
Best regards 

‫في الاثنين، 10 يناير 2022 في 6:43 م تمت كتابة ما يلي بواسطة ‪Tom Henderson‬‏ <‪to...@tomh.org‬‏>:‬
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/ece3397d-fcd3-17fe-488b-68b9f246bf9b%40tomh.org.

baghiani rida

unread,
Apr 2, 2023, 6:24:10 AM4/2/23
to ns-3-users
HI,every one i have a same problem please malik saad give me what you are added as argument to AdTraceSource()call ,iam working with ns3.35
thanks for response in advance

Tommaso Pecorella

unread,
Apr 2, 2023, 9:50:23 AM4/2/23
to ns-3-users
Hi all,

for future reference - and if anybody ever ask this again... read the CHANGES.md file (the file name is all-caps, I'm not shouting - even if perhaps I should).

* We have now documented the callback function signatures for all `TracedSources`, using an extra (fourth) argument to `TypeId::AddTraceSource` to pass the fully-qualified name of the signature typedef. To ensure that future TraceSources are similarly documented, the three argument version of AddTraceSource has been deprecated.

This is pretty clear: TypeId::AddTraceSource was (previously) using 3 arguments, now it requires 4 arguments. Moreover, the deprecated version (the one with 3 arguments) has been removed altogether from ns-3 in a later release. Honestly, we can't do much more than documenting the changes, isn't it?

If someone is too lazy to check the deprecated and new functions, I'll give you an hint: the missing 4th parameter is:
   * \param [in] callback Fully qualified typedef name for the callback signature.  Generally this should begin with the "ns3::" namespace qualifier.
as an example, it might be "ns3::TracedValueCallback::Double" for a Trace involving doubles.

To figure out what to write in the missing param, one can easily (?) check the code of a working file or example, and figure out.
Reply all
Reply to author
Forward
0 new messages