atomicobject/heatshrink

Fix compilation on MinGW

Closed this issue · 2 comments

Hi there,

great bunch of code!

However, when I was testing it, I was stuck to MinGW; but there's nor "err.h".

Workaround: replace

#include <err.h>

by

#if !defined(__MINGW32__)
#include <err.h>
#else

#define err(retval, ...) do { \
    fprintf(stderr, __VA_ARGS__); \
    fprintf(stderr, "Undefined error: %d\n", errno); \
    exit(retval); \
} while(0)

#endif

in heatshrink.c. After that, it compiles and runs flawlessly.

Looks good. There are a few similar issues related to headers on other platforms, and I want to see if there's a clean way to handle all of them (probably wrapping all invocations of err). I will make sure MinGW is covered, though. Thanks for the good bug report.

This should now be resolved, via #10 and #12 .