Error with new cygwin

Posted by Ardentcrest on Wed 12 Sep 2018 07:10 AM — 6 posts, 23,848 views.

#0
I'm getting this error with cygwin

 
$ make
make -s smaug
  Compiling o/imc.o....
imc.c: In function ‘void imc_update_tellhistory(CHAR_DATA*, const char*)’:
imc.c:1565:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
       if( IMCTELLHISTORY( ch, x ) == '\0' )
                                      ^~~~
make[1]: *** [Makefile:102: o/imc.o] Error 1
make: *** [Makefile:46: all] Error 2


any help
Australia Forum Administrator #1
\0 is really zero, so try replacing that with just 0.
Amended on Wed 12 Sep 2018 02:18 PM by Nick Gammon
#2
that worked now getting this


  Compiling o/act_wiz.o....
act_wiz.c: In function ‘bool create_new_race(int, char*)’:
act_wiz.c:8824:6: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
 bool create_new_race( int rcindex, char *argument )
      ^~~~~~~~~~~~~~~
act_wiz.c:8834:12: note: ‘snprintf’ output between 1 and 17 bytes into a destination of size 16
    snprintf( race_table[rcindex]->race_name, 16, "%-.16s", argument );
    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:102: o/act_wiz.o] Error 1
make: *** [Makefile:46: all] Error 2
Amended on Wed 12 Sep 2018 06:08 PM by Ardentcrest
#3
Found out this Error is because of a bug in one of the GCC files.

I just removed the -Werror flag and it compiled fully after changing all "\0" with 0.
Australia Forum Administrator #4
That flag just makes warnings become errors. They always were warnings, but with that flags it won’t let you compile them.

The idea behind that is the warnings are there for a reason, and you may find that even though it compiles you may have run time issues.
#5
This is a confirmed bug of "snprintf" in GCC 7 and 8

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80924

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78969

I believe Its just the warning coming up is the bug but the code should still work