Skip to content

Fix compilation error on Windows (MSYS64)#402

Open
homes32 wants to merge 1 commit intocsete:masterfrom
homes32:fix-map-selector
Open

Fix compilation error on Windows (MSYS64)#402
homes32 wants to merge 1 commit intocsete:masterfrom
homes32:fix-map-selector

Conversation

@homes32
Copy link
Contributor

@homes32 homes32 commented Mar 22, 2026

This PR addresses a build failure encountered when compiling Gpredict on Windows using the MSYS64 environment.

../src/map-selector.c:105:42: error: passing argument 2 of 'g_stat' from incompatible pointer type [-Wincompatible-pointer-types]
  105 |          if (G_UNLIKELY(g_stat(selection, &sb) < 0))
      |                                           ^~~
      |                                           |
      |                                           struct stat *
note: expected 'GStatBuf *' {aka 'struct _stat64 *'} but argument is of type 'struct stat *'

The issue stems from a type mismatch in g_stat calls within src/map-selector.c. While struct stat is standard on Linux, GLib on Windows expects GStatBuf (which maps to struct _stat64). Passing a standard struct stat pointer results in an incompatible-pointer-types error.

Changes

Replaced struct stat with the portable GLib type GStatBuf in create_preview_widget() and update_preview_widget().

This ensures that g_stat receives the correct pointer type.

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