#GCC 14.2.0 seems to have the wrong signal.h

1 messages · Page 1 of 1 (latest)

karmic harness
#

I'm trying to compile some code that has uses sig_t but the version of signal.h that gcc 14.2.0 is using doesn't define sig_t, (although the version in /usr/include does.)

I'm sure this is pilot error but I have no idea what I need to do to fix it. Here's a very short example of the problem.

https://pastebin.com/MxHgrt9y

What am I missing?

green frigate
#

I don't think sig_t is part of the Windows API

#

if you need unix APIs, use the MSYS environ and the gcc there (currently at 13.3.0)

karmic harness
#

sig_t is a BSDism that GCC supports. it's just a typedef for signal function pointer. But switching to MSYS environ does get me past that problem, so I'll do that. Thanks.

wraith wraith
#

I don't think gcc has to "support" it but rather your libc does, either mingw-w64 or msys2

karmic harness
#

It's an include file thing. sig_t is a typedef in signal.h. It's a compiler thing to the extent the compiler's include search path is pointing to a directory with a version of signal.h that doesn't have the definition. mingw64 gcc is finding /mingw64/include/signal.h which doesn't have the definition, but msys gcc is finding /usr/include/signal.h which does.

forest sage
#

Ah so you're trying to mix the two that should never be mixed. PERIOD

#

If you're using mingw gcc, it's best to follow the windows API, POSIX signals don't really work on windows

karmic harness
#

I'm trying to port an application that was originally written for Linux so that it runs on Windows but I'm new to MSYS2 so I'm stumbling around a bit.

#

sig_t isn't POSIX, by the way. It's a convenience typedef that would work even in the windows API.