error: redefinition of 'time' as different kind of symbol
Brought to you by:
roever
toppler 1.1.6 does not compile on OS X 10.11 El Capitan. The errors are:
bonus.cc:51:15: error: redefinition of 'time' as different kind of symbol
static Sint32 time;
^
/usr/include/time.h:116:8: note: previous definition is here
time_t time(time_t *);
^
bonus.cc:65:12: error: comparison between pointer and integer ('time_t (*)(time_t *)' (aka 'long (*)(long *)') and 'int')
if (time < gametime/2)
~~~~ ^ ~~~~~~~~~~
bonus.cc:66:19: error: invalid operands to binary expression ('int' and 'time_t (*)(time_t *)' (aka 'long (*)(long *)'))
towerpos = -(4*time);
~^~~~~
bonus.cc:68:44: error: invalid operands to binary expression ('int' and 'time_t (*)(time_t *)' (aka 'long (*)(long *)'))
towerpos = gametime * scrollerspeed - 4*time + SCREENWID + (SPR_SLICEWID*2);
~^~~~~
bonus.cc:78:50: error: invalid operands to binary expression ('time_t (*)(time_t *)' (aka 'long (*)(long *)') and 'int')
scr_draw_submarine(subposy - 20, subposx, time % 9);
~~~~ ^ ~
bonus.cc:140:8: error: non-object type 'time_t (time_t *)' (aka 'long (long *)') is not assignable
time = 0;
~~~~ ^
bonus.cc:257:15: error: comparison between pointer and integer ('time_t (*)(time_t *)' (aka 'long (*)(long *)') and 'int')
if ((time > gametime/2) && !newtowercol) {
~~~~ ^ ~~~~~~~~~~
bonus.cc:263:14: error: comparison between pointer and integer ('time_t (*)(time_t *)' (aka 'long (*)(long *)') and 'int')
if (time == gametime) {
~~~~ ^ ~~~~~~~~
bonus.cc:269:11: error: cannot increment value of type 'time_t (time_t *)' (aka 'long (long *)')
time++;
~~~~^
bonus.cc:272:17: error: arithmetic on a pointer to the function type 'time_t (time_t *)' (aka 'long (long *)')
if (!((time + 20) & 0x3f)) ttsounds::instance()->startsound(SND_SONAR);
~~~~ ^
10 errors generated.
make[2]: *** [bonus.o] Error 1
I guess the problem is that you have a static variable called "time" which conflicts with the system function called "time".
This problem was reported to the MacPorts project years ago against toppler 1.1.1: https://trac.macports.org/ticket/21961. At the time, we fixed it by updating to toppler 1.1.5 which had renamed the "time" static variable to "currtime". Now, toppler 1.1.6 seems to have gone back to the name "time" for the variable, thus reintroducing the problem.
The attached patch renames the variable back to "currtime" to solve the problem again.