[crossfire] [PATCH] Crossfire client linking fails in trunk
Kevin Zheng
kevinz5000 at gmail.com
Mon Aug 11 21:42:34 CDT 2014
On 08/11/2014 14:16, Tolga Dalman wrote:
> CMake is definitely the way to go. Unfortunately, it doesn't yet work
> as expected.
>
> [ 7%] Building C object common/CMakeFiles/cfclient.dir/client.c.o
> /home/tdalman/src/crossfire/client/trunk/common/client.c: In function
> 'init_connection':
> /home/tdalman/src/crossfire/client/trunk/common/client.c:344:21: error:
> storage size of 'hints' isn't known
> struct addrinfo hints;
> ^
>
> A quick analysis shows the reason explained here:
>
> https://stackoverflow.com/questions/12024703/why-cant-getaddrinfo-be-found-when-compiling-with-gcc-and-std-c99
>
> Naturally, I would compile with -std=gnu99, but that's not a portable
> solution :)
Actually, the current `configure` script already adds "-std=gnu99" or
some variant thereof behind your back. While getaddrinfo(3) is a POSIX
extension, it is still relatively portable. On Windows, this issue is
taken care of with a few preprocessor definitions.
In the distant future I may rewrite parts of the client to use the GLib
networking routines, which is portable thanks to the library.
It may not even be this problem at all. I need to go take a closer look
at the code; it may be just that we're missing a header file.
> /home/tdalman/src/crossfire/client/trunk/common/client.c:497:5: warning:
> implicit declaration of function 'freeaddrinfo' [-Wimplicit-function-declaration]
> freeaddrinfo(res);
> ^
Ditto, although I'm fairly certain this is due to a missing header.
> /home/tdalman/src/crossfire/client/trunk/common/client.c: In function
> 'negotiate_connection':
> /home/tdalman/src/crossfire/client/trunk/common/client.c:578:9: warning:
> implicit declaration of function 'usleep' [-Wimplicit-function-declaration]
> usleep(10*1000); /* 10 milliseconds */
> ^
>
> <unistd.h> is not included.
Fixed locally but not committed yet; I want to do all the header fixes
in one go.
Thanks,
Kevin Zheng
More information about the crossfire
mailing list