[Libwebsockets] test-server-v2.0.c

Andy Green andy at warmcat.com
Tue Mar 21 22:43:50 CET 2017



On March 22, 2017 3:09:15 AM GMT+08:00, Joel Winarske <joel.winarske at gmail.com> wrote:
>Is it just me, but when I build on Linux I get the below.  It's
>resolved
>with adding #include <string.h>.

It's not 'just you', but, eg, this doesn't happen on Fedora 25 I use, or the Travis Linux or Apple builds.

I guess it's because the libc includes on those eventually include string.h themselves.  I pushed a patch adding it explicitly.

-Andy

>Joel
>
>[ 63%] Building C object
>CMakeFiles/test-server-v2.0.dir/test-server/test-server-v2.0.c.o
>/home/joel/libwebsockets/test-server/test-server-v2.0.c: In function
>‘main’:
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:278:2: error:
>implicit declaration of function ‘memset’
>[-Werror=implicit-function-declaration]
>  memset(&info, 0, sizeof info);
>  ^
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:278:2: error:
>incompatible implicit declaration of built-in function ‘memset’
>[-Werror]
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:278:2: note:
>include ‘<string.h>’ or provide a declaration of ‘memset’
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:314:4: error:
>implicit declaration of function ‘strncpy’
>[-Werror=implicit-function-declaration]
>    strncpy(interface_name, optarg, sizeof interface_name);
>    ^
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:314:4: error:
>incompatible implicit declaration of built-in function ‘strncpy’
>[-Werror]
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:314:4: note:
>include ‘<string.h>’ or provide a declaration of ‘strncpy’
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:396:7: error:
>implicit declaration of function ‘strlen’
>[-Werror=implicit-function-declaration]
>   if (strlen(resource_path) > sizeof(cert_path) - 32) {
>       ^
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:396:7: error:
>incompatible implicit declaration of built-in function ‘strlen’
>[-Werror]
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:396:7: note:
>include ‘<string.h>’ or provide a declaration of ‘strlen’
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:403:7: error:
>incompatible implicit declaration of built-in function ‘strlen’
>[-Werror]
>   if (strlen(resource_path) > sizeof(key_path) - 32) {
>       ^
>/home/joel/libwebsockets/test-server/test-server-v2.0.c:403:7: note:
>include ‘<string.h>’ or provide a declaration of ‘strlen’
>cc1: all warnings being treated as errors
>CMakeFiles/test-server-v2.0.dir/build.make:62: recipe for target
>'CMakeFiles/test-server-v2.0.dir/test-server/test-server-v2.0.c.o'
>failed
>make[2]: ***
>[CMakeFiles/test-server-v2.0.dir/test-server/test-server-v2.0.c.o]
>Error 1
>CMakeFiles/Makefile2:215: recipe for target
>'CMakeFiles/test-server-v2.0.dir/all' failed
>make[1]: *** [CMakeFiles/test-server-v2.0.dir/all] Error 2
>Makefile:149: recipe for target 'all' failed
>make: *** [all] Error 2



More information about the Libwebsockets mailing list