error: ISO C++ forbids declaration of

top of the day all

please I have some errors on this that I am having issues to solve.
thanks for the time
/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()’


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- 
/* -*-	drop_tail.h
#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 
you have two functions of the same signature override(). Also, their respective return types are not mentioned (void or bool or whatever).
You have 2 problems.
1 Its like it says here http://en.cppreference.com/w/cpp/language/override
override without the ();
And you need to set the compiler to use the x11 standard, and not the x03 one
@abhishekm71
thanks for the time. please what are your suggestions
I changed the code to the old version but it still gives almost the same error. Can I change the signatures override1() and override2()


or if you please have a better way that it should be done.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* -*-	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
 
if you want to override the virtual functions empty() and get_hol() using the c++11 functionality, you should follow nedo's suggestions.
what compiler/ide are you using?
thanks all

@nedo

please how can I set the compiler to use the x11 standard, and not the x03 one?
first look at this page and check if your compiler supports the new c++11 function that you want, in cthis case override keyword.
http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/
If you are using code blocks, it probably has g++ 4.7 that doesn\t have the override keyword implemented.
But you can use the other c++11 things that are implemented by doing what the second post here ->http://en.sfml-dev.org/forums/index.php?topic=8860.0 says.
If you are using visuas studio 2010 again, it might not have the override keyword implemented.
Last edited on
I am running the program on ns 2.35 with Ubuntu 12.04LTS. I am installing ns 2.35 really but one of the header file to be used by the makefile.ini is having issues.
I don't know what ns is. Networks Simulators ?
http://www.nsnam.com/2011/11/ns2-ns-235-installation-in-ubuntu-1110.html
yes it is Network simulator just as you have pointed in the link. But what I wanted to do is to add a few files for the work I am doing so I could get Poissons traffic. When I added the file and
http://www.iis.sinica.edu.tw/~cclljj/misc/notes/poisson.cc.html
https://github.com/iszczesniak/opus/blob/master/poisson.cc

there are errors may be because of version compatibility or so. I have not been able to fix it. then I picked a new set of folders
Shouldn't this:
virtual bool empty() ;const override;
be like this:
virtual bool empty() const override;
??
Yes, the first semicolon should be removed.
Topic archived. No new replies allowed.