While trying to compile on Ubuntu 12.04 64bits I get the following error:
In file included from /home/daniel/Programs/cdogs-sdl/src/cdogs/input.h:56:0,
from /home/daniel/Programs/cdogs-sdl/src/cdogs/gamedata.h:53,
from /home/daniel/Programs/cdogs-sdl/src/cdogs/actors.h:52,
from /home/daniel/Programs/cdogs-sdl/src/cdogs/actors.c:49:
/home/daniel/Programs/cdogs-sdl/src/cdogs/sys_specifics.h:74:13: error: conflicting types for ‘ssize_t’
/usr/include/x86_64-linux-gnu/sys/types.h:110:19: note: previous declaration of ‘ssize_t’ was here
make[2]: *** [cdogs/CMakeFiles/cdogs.dir/actors.c.o] Error 1
make[1]: *** [cdogs/CMakeFiles/cdogs.dir/all] Error 2
make: *** [all] Error 2
The offending line corresponds to this:
#if !defined(ssize_t) && !defined(__MACTYPES__)
typedef int ssize_t;
#endif
But since ssize_t is a typedef and not a macro (created by #define), the defined() function won't work. I have wrote the following program as an example:
#include <stdio.h>
/*typedef int ssize_t;*/
int main(int argc, const char *argv[])
{
#if defined(ssize_t)
printf("Hello\n");
#endif
return 0;
}
If I uncomment the typedef, the program won't compile, because ssize_t is defined in stdio. It won't print "Hello\n", however, because defined() won't detect the typedef.
In sys/types.h, the typedef is declared as follows:
While trying to compile on Ubuntu 12.04 64bits I get the following error:
The offending line corresponds to this:
But since ssize_t is a typedef and not a macro (created by #define), the defined() function won't work. I have wrote the following program as an example:
If I uncomment the typedef, the program won't compile, because ssize_t is defined in stdio. It won't print "Hello\n", however, because defined() won't detect the typedef.
In sys/types.h, the typedef is declared as follows:
I tried to use defined(__size_t_defined) in place of defined(ssize_t) and it compiled.