r1353 compile errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PaulBlay
    Knight
    • Jan 2009
    • 657

    r1353 compile errors

    object/identify.c(166) : error C2275: 'u32b' : illegal use of this type as an ex
    pression
    c:\rl\angband311\src\h-basic.h(223) : see declaration of 'u32b'
    object/identify.c(166) : error C2146: syntax error : missing ';' before identifier 'curses'
    object/identify.c(166) : error C2065: 'curses' : undeclared identifier
    object/identify.c(169) : error C2065: 'curses' : undeclared identifier
    object/identify.c(173) : error C2065: 'curses' : undeclared identifier

    You need to change object_notice_curses as follows.

    Code:
    bool object_notice_curses(object_type *o_ptr)
    {
            u32b f[OBJ_FLAG_N];
            [b]u32b curses;[/b]
            object_flags(o_ptr, f);
            [b]curses = (f[2] & TR2_CURSE_MASK);[/b]
            
            /* Know whatever curse flags there are to know */
            o_ptr->known_flags[2] |= curses;
    
            p_ptr->notice |= PN_SQUELCH;
    
            return (curses ? TRUE : FALSE);
    }
    Currently turning (Angband) Japanese.
  • Pete Mack
    Prophet
    • Apr 2007
    • 6883

    #2
    Surely, surely, we can move to C99 by now, after a whole decade? The only file that enforces c90 is Makefile.win. Everything else assumes the default. (Which is C99 for most compilers...)

    I even checked Open Watcom, and it has support for mixed code and declaration in partial c99 compliance, using -za99 compiler flag.

    Comment

    • PaulBlay
      Knight
      • Jan 2009
      • 657

      #3
      I also get the following error when using VC++ Command Prompt with Makefile.nmake.

      debug.o : warning LNK4217: locally defined symbol __iob imported in function _to_stderr
      z-util.o : warning LNK4049: locally defined symbol __iob imported
      cave.o : error LNK2019: unresolved external symbol __alloca referenced in function _display_map
      score.o : error LNK2001: unresolved external symbol __alloca
      Angband.exe : fatal error LNK1120: 1 unresolved externals
      Currently turning (Angband) Japanese.

      Comment

      • PaulBlay
        Knight
        • Jan 2009
        • 657

        #4
        Originally posted by Pete Mack
        The only file that enforces c90 is Makefile.win.
        And Makefile.nmake apparently.

        In r1354

        Code:
        void object_notice_flag(int flagset, u32b flag)
        {
                int i;
        
                for (i = INVEN_WIELD; i < INVEN_TOTAL; i++)
                {
                        object_type *o_ptr = &inventory[i];
                        u32b f[OBJ_FLAG_N];
        
                        object_flags(o_ptr, f);
                        if ((f[flagset] & flag) &&
                                        !(o_ptr->known_flags[flagset] & flag))
                        {
                                char o_name[80];
                                object_desc(o_name, sizeof(o_name), o_ptr, FALSE,
                                                ODESC_BASE);
        
                                /* Notice flags */
                                o_ptr->known_flags[flagset] |= flag;
        
                                for ([B][COLOR="Red"]size_t [/COLOR][/B]j = 0; j < N_ELEMENTS(msgs); j++)
                                {
                                        if (msgs[j].flagset == flagset &&
                                                        (msgs[j].flag & flag))
                                                msg_format(msgs[j].msg, o_name);
                                }
                        }
                }       
        
                return;
        }
        Currently turning (Angband) Japanese.

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Originally posted by Pete Mack
          Surely, surely, we can move to C99 by now, after a whole decade? The only file that enforces c90 is Makefile.win. Everything else assumes the default. (Which is C99 for most compilers...)
          I'm no expert, but there are a lot of commits to trunk which are tidying-up to preserve C89 compatibility, so it looks quite important.
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • takkaria
            Veteran
            • Apr 2007
            • 1951

            #6
            Originally posted by PaulBlay
            I also get the following error when using VC++ Command Prompt with Makefile.nmake.

            debug.o : warning LNK4217: locally defined symbol __iob imported in function _to_stderr
            z-util.o : warning LNK4049: locally defined symbol __iob imported
            cave.o : error LNK2019: unresolved external symbol __alloca referenced in function _display_map
            score.o : error LNK2001: unresolved external symbol __alloca
            Angband.exe : fatal error LNK1120: 1 unresolved externals
            Try doing a clean make and going again? (The C89 things should be fixed now.)
            takkaria whispers something about options. -more-

            Comment

            • PaulBlay
              Knight
              • Jan 2009
              • 657

              #7
              Originally posted by takkaria
              Try doing a clean make and going again? (The C89 things should be fixed now.)
              It was OK at r1357 (I cleared out all the old *.o files just in case).

              I suppose I should have tried one without doing that to see if it was any different, but too late now.
              Currently turning (Angband) Japanese.

              Comment

              • Pete Mack
                Prophet
                • Apr 2007
                • 6883

                #8
                alloca is not used in angband--it's highly non-portable. Did you change compile options?

                Comment

                • PaulBlay
                  Knight
                  • Jan 2009
                  • 657

                  #9
                  Originally posted by Pete Mack
                  alloca is not used in angband--it's highly non-portable. Did you change compile options?
                  No, I used the same makefile both times.
                  Currently turning (Angband) Japanese.

                  Comment

                  • Pete Mack
                    Prophet
                    • Apr 2007
                    • 6883

                    #10
                    Are you absolutely sure all the .o files--including those in subdirectories--are compiled with the same compiler? Those errors look suspiciously like mismatched libraries, aka DLL Hell.
                    Last edited by Pete Mack; April 13, 2009, 07:00.

                    Comment

                    • PaulBlay
                      Knight
                      • Jan 2009
                      • 657

                      #11
                      Originally posted by Pete Mack
                      Are you absolutely sure all the .o files--including those in subdirectories--are compiled with the same compiler? Those errors look suspiciously like mismatched libraries, aka DLL Hell.
                      Not 100% sure, but there's no way to check now.
                      Currently turning (Angband) Japanese.

                      Comment

                      Working...
                      😀
                      😂
                      🥰
                      😘
                      🤢
                      😎
                      😞
                      😡
                      👍
                      👎