nescom icon indicating copy to clipboard operation
nescom copied to clipboard

No feature-inclusion macro defined (trivial; causes FTB on Cygwin)

Open micahcowan opened this issue 5 years ago • 0 comments

Hello. I'm sure Cygwin isn't exactly a priority support-wise, but the fix is trivial and it does actually represent a deficiency, though apparently one most standard GNUish programming environments are willing to forgive (else there'd already be an issue for this).

The issue is that no _GNU_SOURCE or similar macro is defined before including standard headers; this results in failures to build, because although various functions like ftruncate and fileno get used, they are not declared if the suitable feature macro has not been defined. I imagine setting _POSIX_C_SOURCE to something suitable would also get the job done.

However, since the Makefile assumes gcc, the simplest way to fix the issue (did the trick for me) was to change the Makefile to set CXX += -std=gnu++1z instead of CXX += -std=c++1z.

As to why I encountered this issue in the first place: AFAICT GNU libc is presumably happy enough to supply these optional symbols anyway without a suitable feature-test macro #defined, but Cygwin apparently uses something called "The Red Hat newlib C Library" (or that's what info libc gives me when I've installed the cygwin-doc package).

Thanks for writing this handy resource! I've been using clever-disasm to explore Trog for the NES, as I wish to modify it to allow playing with two players on the Famicom (the game assumes 2P has a start button).

micahcowan avatar Mar 10 '20 22:03 micahcowan