tree.hh 无法在 Ubuntu 14.04 上编译

tree.hh doesn't compile on Ubuntu 14.04

本文关键字:编译 Ubuntu hh tree      更新时间:2023-10-16

我使用的是来自http://tree.phi-sci.com/download.html.它会产生错误(请参见下文)。我该怎么修?这个类怎么会产生这么多错误?提前谢谢你的建议?

In file included from item_tree.h:4:0,
                   from Player.h:44,
                   from xinemediaplayer.c:26:
tree.hh:82:36: error: expected ‘,’ or ‘...’ before ‘&&’ token
     tree(tree<T, tree_node_allocator>&&);           // move constructor^M
                                      ^
  tree.hh:82:38: error: invalid constructor; you probably meant ‘tree<T, tree_node_allocator> (const tree<T, tree_node_allocator>&)’
     tree(tree<T, tree_node_allocator>&&);           // move constructor^M
                                        ^
  tree.hh:85:70: error: expected ‘,’ or ‘...’ before ‘&&’ token
     tree<T,tree_node_allocator>& operator=(tree<T, tree_node_allocator>&&);        // move assignment^M
                                                                        ^
  tree.hh:503:64: error: expected ‘,’ or ‘...’ before ‘&&’ token
   tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>&& x) ^M
                                                                  ^
  tree.hh:503:1: error: prototype for ‘tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>)’ does not match any in class ‘tree<T, tree_node_allocator>’
   tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>&& x) ^M
   ^
  tree.hh:81:3: error: candidates are: tree<T, tree_node_allocator>::tree(const tree<T, tree_node_allocator>&)
     tree(const tree<T, tree_node_allocator>&);      // copy constructor^M
     ^
  tree.hh:80:3: error:                 tree<T, tree_node_allocator>::tree(const tree<T, tree_node_allocator>::iterator_base&)
     tree(const iterator_base&);^M
     ^
  tree.hh:496:1: error:                 tree<T, tree_node_allocator>::tree(const T&)
   tree<T, tree_node_allocator>::tree(const T& x) ^M
   ^
  tree.hh:490:1: error:                 tree<T, tree_node_allocator>::tree()
   tree<T, tree_node_allocator>::tree() ^M
   ^
  tree.hh:562:98: error: expected ‘,’ or ‘...’ before ‘&&’ token
   tree<T,tree_node_allocator>& tree<T, tree_node_allocator>::operator=(tree<T, tree_node_allocator>&& x)^M
                                                                                                    ^
  tree.hh: In member function ‘tree<T, tree_node_allocator>& tree<T, tree_node_allocator>::operator=(tree<T, tree_node_allocator>)’:...

tree.hh的一个例子:

64 template <class T, class tree_node_allocator = std::allocator<tree_node_<T> > >
65 class tree {
66         protected:
67                 typedef tree_node_<T> tree_node;
68         public:
69                 /// Value of the data stored at a node.
70                 typedef T value_type;
71
72                 class iterator_base;
73                 class pre_order_iterator;
74                 class post_order_iterator;
75                 class sibling_iterator;
76       class leaf_iterator;
77
78                 tree();                                         // empty constructor
79                 tree(const T&);                                 // constructor setting given element as head
80                 tree(const iterator_base&);
81                 tree(const tree<T, tree_node_allocator>&);      // copy constructor
82                 tree(tree<T, tree_node_allocator>&&);           // move constructor
83                 ~tree();
84                 tree<T,tree_node_allocator>& operator=(const tree<T, tree_node_allocator>&);   // copy assignment
85                 tree<T,tree_node_allocator>& operator=(tree<T, tree_node_allocator>&&);        // move assignment
86
87       /// Base class for iterators, only pointers stored, no traversal logic.
88 #ifdef __SGI_STL_PORT
89                 class iterator_base : public stlport::bidirectional_iterator<T, ptrdiff_t> {
90 #else

Makefile是:

1 PLUGIN = xinemediaplayer
2 OBJS = $(PLUGIN).o Control.o Player.o Reel.o SpuDecode.o Utils.o 
3                 curl_download.o imagetools.o 
4                 item_tree.o  m3u_parser.o pls_parser.o timecounter.o 
5                 xineOsd.o xineOsdInfoMenu.o xineOsdFunction.o Playlist.o
6 VDRDIR = ../../..
7 LIBDIR = ../../lib
8 TMPDIR = /tmp
9 -include $(VDRDIR)/Make.config
10 ARCHIVE = $(PLUGIN)-$(VERSION)
11 PACKAGE = vdr-$(ARCHIVE)
12   OBJS += cddb.o cdtext.o cdrom.o
13   OBJS += XineLib.o GstreamerLib.o gstTools.o ExternalLib.o
14   LIBS += -lxine `pkg-config --libs gstreamer-0.10` `pkg-config --libs gstreamer-interfaces-0.10`
15   INCLUDES += `pkg-config --cflags gstreamer-0.10`  `pkg-config --cflags gstreamer-interfaces-0.10`
16 -include $(VDRDIR)/Make.common
17 INCLUDES +=
18   INCLUDES +=`taglib-config --cflags`
19   LDFLAGS  +=`taglib-config --libs`
20   LIBS     += `curl-config --libs` -lcdio -lcddb
21
22 DEFINES += -DPLAYER_VERSION="$(PLAYER_VERSION)" -D__LINUX__ -D__STL_CONFIG_H
23
24 target-for-compatibility-with-vanilla-vdr:
25         $(LIBDIR)/$@.$(APIVERSION)

Make.config:

 1 REELVDR=1
 2 DEBUG = 1
 3 VDRVER ?= 2.1
 4 CCACHE := $(shell which ccache)
 5 MAKE  += -j3
 6 LSB_RELEASE := $(shell lsb_release -sr)
 7         MACHINE  ?= -m32 -march=pentium3 -mmmx -msse -mfpmath=sse
 8 CC       = $(CCACHE) $(DISTCC) $(CROSS)gcc
 9 CFLAGS   = -O2 -g -pg $(MACHINE)
10 CXX      = $(CCACHE) $(DISTCC) $(CROSS)g++
11 CXXFLAGS = -g3 -funroll-loops -fomit-frame-pointer $(MACHINE) -Wall -Woverloaded-virtual  -D_FILE_OFFSET_BITS=64 -D_    LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
12 STRIP    = $(CROSS)strip
13 export CC CXX CFLAGS CXXFLAGS
14         CC  := $(CC)-4.8
15         CXX := $(CXX)-4.8
16         DEFINES += -DDVBAPI_V5
17         DEFINES += -DNEW_FFMPEG
18         USEMYSQL = 1
19         DEVICE_ATTRIBUTES = 1
20         DVBDIR  := /usr/src/linux-headers-3.13.0-66-generic/include/config/dvb
21         VDRVER  := 2.1

amp&是C++11的特性。进行g++调用时,应使用--std=c++11--std=gnu++11命令行选项。