ravachol / kew

A command-line music player
GNU General Public License v2.0
567 stars 21 forks source link

error: use of undeclared identifier 'SIGWINCH' #115

Closed yurivict closed 7 months ago

yurivict commented 7 months ago

Build fails:

src/term.c:275:16: error: use of undeclared identifier 'SIGWINCH'
        signal(SIGWINCH, handleResize);
               ^
1 error generated.

Version: 2.2 FreeBSD 14.0

ravachol commented 7 months ago

I was under the impression that SIGWINCH existed on BSD through signal.h which is included in term.h.

This is what it says in the arch one: / Nonstandard signals found in all modern POSIX systems (including both BSD and Linux). /

define SIGWINCH 28 / Window size change (4.3 BSD, Sun). /

yurivict commented 7 months ago

SIGWINCH definitely exists on FreeBSD.

#define _POSIX_C_SOURCE 2 in term.h causes SIGWINCH to disappear. When #include <signal> is before #include "term.h" - it builds fine.

Do you know why #define _POSIX_C_SOURCE 2 is needed?

ravachol commented 7 months ago

It's required for defining sigaction. But it seems I can use #define _POSIX_C_SOURCE 200809L instead.

You could try it with

ifndef _POSIX_C_SOURCE

define _POSIX_C_SOURCE 200809L

endif

instead of _POSIX_C_SOURCE 2 see if it compiles.

yurivict commented 7 months ago

It still fails to build with #define _POSIX_C_SOURCE 200809L.


The manpage sigaction(2) doesn't mention that _POSIX_C_SOURCE should be define for it to be available.

ravachol commented 7 months ago

it was vscode that was complaining but I found a way around it. removed the #define in the latest commit.