Dominique Dumont wrote:
I'm trying to compile Sascha Volkenandt's streamdev plugin and I have the following error:
g++ -W -Woverloaded-virtual -O2 -c -D_GNU_SOURCE -DHAVE_AUTOPID -I../../../include -I../../../../DVB/include -I. -o streamdev-client.o streamdev-client.c ./tools/list.h:93: error: declaration of 'operator+=' as non-function ./tools/list.h:93: error: expected ';' before '<' token
Here's one of the problematic line:
friend cTBList<T> &operator+= <> (cTBList<T> &list1, const cTBList<T> &list2);
This is not latest CVS streamdev, it must be some older version.
Anyway, this is a GCC-4 compatibility issue. GCC4 follows the ISO C++ standard very closely, while GCC3 allowed some non-standard things to pass through.
In this case: A friend declaration no longer is a forward declaration, so these operators have to be forward-declared.
The following is from a patch for mplayercluster, that uses a variant of clist:
// ANSI/ISO C++ and GCC4 require template friend functions to be forward-declared... template <class T> class cTBList; template <class T> inline cTBList<T> &operator+= (cTBList<T> &list1, const cTBList<T> &list2); template <class T> inline cTBList<T> &operator+= (cTBList<T> &list, const T &element); template <class T> inline cTBList<T> operator+ (const cTBList<T> &list1, const cTBList<T> &list2); template <class T> inline cTBList<T> operator+ (const T &element, const cTBList<T> &list); template <class T> inline cTBList<T> operator+ (const cTBList<T> &list, const T &element);
Put it right before the template <class T> class cTBList declaration. It might need some modifications, depends on your clist.h.
Cheers,
Udo