LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-07-2013, 11:45 AM   #1
goodGOD
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Rep: Reputation: 0
error: ISO C++ forbids declaration...for ns2.35


top of the day all

please I have some errors on this that I am having issues to solve.
thanks for the time

errors shown are

Code:
/drop-tail.h:63:48: error: ISO C++ forbids declaration of ‘override’ with no type [-fpermissive]
/drop-tail.h:66:51: error: ISO C++ forbids declaration of ‘override’ with no type [-fpermissive]
/drop-tail.h:66:41: error: ‘const int DropTail::override()’ cannot be overloaded
/drop-tail.h:63:38: error: with ‘const int DropTail::override()’
Code:
/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
/*
 
 *
 * @(#) $Header: /cvsroot/nsnam/ns-2/queue/drop-tail.h,v 1.19 2004/10/28 23:35:37 haldar Exp $ (LBL)
 */

#ifndef ns_drop_tail_h
#define ns_drop_tail_h

#include <string.h>
#include "queue.h"
#include "config.h"
#include <float.h>

/*
 * A bounded, drop-tail queue
 */
class DropTail : public Queue {
  public:
	DropTail() { 
		q_ = new PacketQueue; 
		pq_ = q_;
		bind_bool("drop_front_", &drop_front_);
		bind_bool("summarystats_", &summarystats);
		bind_bool("queue_in_bytes_", &qib_);  // boolean: q in bytes?
		bind("mean_pktsize_", &mean_pktsize_);
		//		_RENAMED("drop-front_", "drop_front_");
	}
	~DropTail() {
		delete q_;
	}

        virtual bool empty() ; const override ();
	// johna 07 06 2013 virtual bool empty() ;const override;
	// johna 07 06 2013 virtual double get_hol() const override { return (empt
        virtual double get_hol(); const override () { return (empty()) ? DBL_MAX : hdr_cmn::access(q_->head())->timestamp(); }
  protected:
	void reset();
	int command(int argc, const char*const* argv); 
	void enque(Packet*);
	Packet* deque();
	void shrink_queue();	// To shrink queue and drop excessive packets.

	PacketQueue *q_;	/* underlying FIFO queue */
	int drop_front_;	/* drop-from-front (rather than from tail) */
	int summarystats;
	void print_summarystats();
	int qib_;       	/* bool: queue measured in bytes? */
	int mean_pktsize_;	/* configured mean packet size in bytes */
};

#endif
 
Old 06-07-2013, 12:24 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Did you write this code or download it from somewhere or what?

This line of code is incorrect:

Code:
        virtual bool empty() ; const override ();
But I don't have a guess of what whoever wrote that actually intended.

Edit: I think probably the intended code is:
Code:
        virtual bool empty() const override;
and similar change for the other place where you have the same mistake.

But that seems like that would be changing the code back to the way it was before, which brings up the question: why did you break it to begin with?

If something was wrong before, that you tried to correct with that misguided change, it would have been better to post the earlier version and the original problem, rather than obscure things by adding a new error.

Was the original code you started with this:
https://github.com/hbatmit/ns2.35/bl...ue/drop-tail.h
What were you trying to accomplish with your changes?

Last edited by johnsfine; 06-07-2013 at 12:39 PM.
 
1 members found this post helpful.
Old 06-08-2013, 04:07 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
A default ns-2.35 build can be done with

$ cd ns-allinone-2.35/ && export CC=gcc-4.4 CXX=g++-4.4 && ./install

I.e. no editing of any files is required.
 
Old 06-08-2013, 06:59 AM   #4
goodGOD
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Original Poster
Rep: Reputation: 0
@johnsfine @knudfl, thanks all for the reply and concern.

yes I downloaded it for that site after I have had a working ns 2.35 and I have done some other project ont it. Then I needed a poisson distribution (poisson.cc etc) source but it is not native to ns 2.35. I tried to use the one here since it has some poisson links charactersitics. It seems it an updated version by that user but when I was building it, there exists those errors that I gave earlier but in another form of
Quote:
there is a need for ; and virtual is empty etc
in
Quote:
virtual bool empty() const override;
so I did comment off some of them but again there was this error that I gave ealier on the 1st post.

thanks for the time once agin that was so kind. I have read how I could merge two ns2 version on Ubuntu but they are the same ns2.35 only general one and one thone by a user. If you have more suggestions or what I need to do on it, I will really appreciate it.

so to be precise @johnsfine, I changed it because when building it gave error with

Code:
virtual bool empty() const override;
virtual double get_hol() const override { return (empty()) ? DBL_MAX : hdr_cmn::access(q_->head())->timestamp(); }
the main program is this
Code:
/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
/*

 *
 * @(#) $Header: /cvsroot/nsnam/ns-2/queue/drop-tail.h,v 1.19 2004/10/28 23:35:37 haldar Exp $ (LBL)
 */

#ifndef ns_drop_tail_h
#define ns_drop_tail_h

#include <string.h>
#include "queue.h"
#include "config.h"
#include <float.h>

/*
 * A bounded, drop-tail queue
 */
class DropTail : public Queue {
  public:
	DropTail() { 
		q_ = new PacketQueue; 
		pq_ = q_;
		bind_bool("drop_front_", &drop_front_);
		bind_bool("summarystats_", &summarystats);
		bind_bool("queue_in_bytes_", &qib_);  // boolean: q in bytes?
		bind("mean_pktsize_", &mean_pktsize_);
		//		_RENAMED("drop-front_", "drop_front_");
	}
	~DropTail() {
		delete q_;
	}

     	 virtual bool empty() ;const override;
	 virtual double get_hol() const override { return (empty()) ? DBL_MAX : hdr_cmn::access(q_->head())->timestamp(); }
  protected:
	void reset();
	int command(int argc, const char*const* argv); 
	void enque(Packet*);
	Packet* deque();
	void shrink_queue();	// To shrink queue and drop excessive packets.

	PacketQueue *q_;	/* underlying FIFO queue */
	int drop_front_;	/* drop-from-front (rather than from tail) */
	int summarystats;
	void print_summarystats();
	int qib_;       	/* bool: queue measured in bytes? */
	int mean_pktsize_;	/* configured mean packet size in bytes */
};

#endif

Last edited by goodGOD; 06-08-2013 at 07:02 AM.
 
Old 06-08-2013, 07:41 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 4 .

No reason to add the file to ns-2.35, if it will fit better in another version :
You can have as many versions of ns-allinone as you want,
installed at the same time. But do not add any path text to .bashrc.
 
Old 06-08-2013, 07:48 AM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by goodGOD View Post
Then I needed a poisson distribution (poisson.cc etc) source but it is not native to ns 2.35. I tried to use the one here
What does "here" mean?

Quote:
It seems it an updated version by that user
A URL might help me have some clue what you are talking about:

Quote:
but when I was building it, there exists those errors that I gave earlier but in another form of
Quote:
there is a need for ; and virtual is empty etc
Who or what are you quoting there?

Quote:
I did comment off some of them but again there was this error that I gave ealier on the 1st post.
Blind changes are not likely to be constructive.

Quote:
Originally Posted by goodGOD View Post
so to be precise @johnsfine, I changed it because when building it gave error with

Code:
virtual bool empty() const override;
virtual double get_hol() const override { return (empty()) ? DBL_MAX : hdr_cmn::access(q_->head())->timestamp(); }
What was the exact error message?

Maybe that would give us some hint what change might be constructive. Adding that ; before the const is most certainly not constructive.

Last edited by johnsfine; 06-08-2013 at 07:51 AM.
 
Old 06-08-2013, 10:35 AM   #7
goodGOD
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Original Poster
Rep: Reputation: 0
thanks all especially for your precious time.

the URL of the ns 2.35 version that I installed is https://github.com/mohaslan/nsj/tree/master/ns-2.35

I used it because it contains poisson traffic characteristics. But the
PHP Code:
"drop-tail.h" 
is having some errors during installation

the original code https://github.com/hbatmit/ns2.35/bl...ue/drop-tail.h
the error message was
Quote:
virtual bool is empty there should be ";"
 
Old 06-08-2013, 12:23 PM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by knudfl View Post
No reason to add the file to ns-2.35, if it will fit better in another version :
You can have as many versions of ns-allinone as you want,
installed at the same time. But do not add any path text to .bashrc.
I'm unclear on what is a "version" in this context. I would have thought 2.35 was a "version".

But the OP is mixing two different sets of source code, both of which seem to say they are "ns-2.35".

There are a lot of differences between
https://github.com/mohaslan/nsj/tree/master/ns-2.35
and
https://github.com/hbatmit/ns2.35/tree/master

A lot of those differences (maybe all) are edits made in the second one by anirudhSK, including adding the code in drop-tail.h that the OP is having trouble with.

I assume the OP has used some drop-tail.h (and maybe other files) from that second ns2.35 together with files from the first ns2.35 and that doesn't work.

Those changes (by anirudhSK) are multi file changes. For example, the changes in drop-tail.h are tightly coupled with the changes in queue.h

Quote:
Originally Posted by goodGOD View Post
the URL of the ns 2.35 version that I installed is https://github.com/mohaslan/nsj/tree/master/ns-2.35

I used it because it contains poisson traffic characteristics.
I don't understand what/why you wanted to get from each of these two sources. If you want something only one of them has, why not use entirely that one?

Last edited by johnsfine; 06-08-2013 at 12:44 PM.
 
Old 06-11-2013, 12:30 PM   #9
goodGOD
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Original Poster
Rep: Reputation: 0
thanks all. I found my way round it and used an old version of Poisson.cc file on the Internet to create the poisson traffic in the network I was working on. So I did not use this again. But thanks so much for your time and kindness.

all
Quote:
@johnsfine But to answer some of the questions raised, I tried to check all the ns2.35 edited version to see if I could use them. thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ISO C++ forbids comparison between pointer and integer dmckay Programming 8 10-15-2009 04:09 PM
error: ISO C++ forbids declaration of 'hash_map' with no type kpachopoulos Programming 1 08-30-2007 06:30 PM
error: ISO C++ forbids comparison ... NEED HELP URGENT !!! lx3000 Programming 5 10-02-2006 02:48 PM
ISO C++ forbids declaration of... lucky6969b Programming 3 03-23-2006 07:54 AM
printk --- ISO C90 forbids mixed declaration and code Igor007 Programming 3 09-08-2005 04:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration