Problem with new sdk
  • Cocoon
    Cocoon
    imax
    Posts: 41 from 2004/9/20
    From: Russia
    Hi All !
    An older version (2003) of the compiler works ok.
    I do try compile of "nether earth remake" at new sdk-20160122 and sdk-20150619
    and i see :

    g++ -O3 -noixemul -c nether.cpp -o nether.o
    In file included from nether.cpp:15:
    list.h:68: `List' is not a template type
    list.h:68: redefinition of `struct List'
    /gg/os-include/exec/lists.h:24: previous definition here
    list.h:70: non-template type `List' used as a template
    list.h:70: ANSI C++ forbids declaration `' with no type
    list.h:70: abstract declarator `int ()()' used as declaration
    list.h:71: non-template type `List' used as a template
    list.h:71: confused by earlier errors, bailing out
    make: *** [nether.o] Error 1

    list.h :

    68 template <class T> class List {
    69 public:
    70 List<T>() {list=0;act=0;top=0;original=true;};
    71 ~List<T>() {
    72 if (original) {
    73 delete list;
    74 } /* if */
    75 };
    76 List<T>(List<T> &l) {list=l.list;act=list;top=l.top;original=false;};
  • »03.02.16 - 20:29
    Profile Visit Website
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    Quote:

    imax wrote:
    Hi All !
    An older version (2003) of the compiler works ok.
    I do try compile of "nether earth remake" at new sdk-20160122 and sdk-20150619
    and i see :


    This is an include issue, and probably not a compiler issue, so I suppose you mean older version of the SDK...

    I'm guessing the problem is that some include (GL/SDL/?) is now including exec/lists.h containing struct List which directly conflicts with the List class in list.h.

    The easiest fix is probably to redefine List in list.h.


    - CISC
  • »04.02.16 - 07:47
    Profile
  • Cocoon
    Cocoon
    imax
    Posts: 41 from 2004/9/20
    From: Russia
    Hi CISC !

    I tried different versions that I had and here's the result:
    SDK2.7 (20110916) - compile OK
    SDK3.2 (20130129) - compile OK
    SDK3.5 (20140508) & newer - compile error
    i did replace the list.h of any version - the result is the same (the same files).
    I had a break in programming at age 6, please tell me how "to redefine List in list.h."
  • »27.02.16 - 20:32
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    BSzili
    Posts: 559 from 2012/6/8
    From: Hungary
    You have two choices: either rename your list class to something else (e.g. MyList) or let the preprocessor do it for you, by adding this line to the beginnig of your list.h:
    Code:
    #define List MyList

    If you choose the latter, make sure to include your list.h after the system headers, or you'll end up redefining List in the system headers too.
    This is just like television, only you can see much further.
  • »27.02.16 - 20:54
    Profile Visit Website