Skip to content

fix mingw32 build errors and warnings - #4

Merged
mattn merged 1 commit into
masterfrom
fix-mingw-build
Aug 18, 2026
Merged

fix mingw32 build errors and warnings#4
mattn merged 1 commit into
masterfrom
fix-mingw-build

Conversation

@mattn

@mattn mattn commented Aug 18, 2026

Copy link
Copy Markdown
Owner

mingw32-make -f Makefile.w32 failed with 'usleep' was not declared in this scope, plus a few warnings. This fixes all of them; a clean build is now warning-free.

  • define usleep() as Sleep() on Win32 so the #ifdef branches around each sleep call can go away. usleep() was undeclared on mingw32 because unistd.h is only included on non-Windows.
  • memset(tm, 0, sizeof(tm)) cleared only the size of the pointer, not the struct it points at.
  • drop the unused loop counter n in res_popen().
  • print the read size with %lld instead of %I64d; current mingw-w64 uses ANSI stdio.
  • drop -mtune=i686 from Makefile.w32.

https://claude.ai/code/session_015AgpKrpE6ejPM4MWRWb8HQ

- define usleep() as Sleep() on Win32 so the #ifdef branches around each
  sleep call can go away. usleep() was undeclared on mingw32 because
  unistd.h is only included on non-Windows.
- memset(tm, 0, sizeof(tm)) cleared only the size of the pointer, not the
  struct it points at.
- drop the unused loop counter n in res_popen().
- print the read size with %lld instead of %I64d; current mingw-w64 uses
  ANSI stdio.
- drop -mtune=i686 from Makefile.w32.

Claude-Session: https://claude.ai/code/session_015AgpKrpE6ejPM4MWRWb8HQ
@mattn
mattn merged commit 73cec56 into master Aug 18, 2026
2 checks passed
@mattn
mattn deleted the fix-mingw-build branch August 18, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant