gvsbuild icon indicating copy to clipboard operation
gvsbuild copied to clipboard

error C2016: C requires that a struct or union has at least one member

Open Zueuk opened this issue 4 years ago • 3 comments

While compiling GTK3 with python .\build.py build -p x64 -c release gtk3-full --vs-ver=15, Windows SDK version 8.1

Building project glib (2.68.3)
[1/819] Compiling C object gio/gio-2.0-0.dll.p/gwin32packageparser.c.obj
FAILED: gio/gio-2.0-0.dll.p/gwin32packageparser.c.obj
"cl" "-Igio\gio-2.0-0.dll.p" "-Igio" "-I..\gio" "-I." "-I.." "-Iglib" "-I..\glib" "-Igobject" "-I..\gobject" "-Igmodule" "-I..\gmodule" "-IC:/gtk-build/gtk/x64/release/bin/../include" "/MD" "/nologo" "/showIncludes" "/W2" "/O2" "/Zi" "/wd4035" "/wd4715" "/wd4116" "/wd4046" "/wd4068" "/wo4090" "/FImsvc_recommended_pragmas.h" "/utf-8" "-D_GNU_SOURCE" "-DG_ENABLE_DEBUG" "-DG_LOG_DOMAIN=\"GLib-GIO\"" "-DGIO_COMPILATION" "-DGIO_MODULE_DIR=\"C:/gtk-build/gtk/x64/release/lib/gio/modules\"" "-DLOCALSTATEDIR=\"C:/gtk-build/gtk/x64/release/var\"" "/Fdgio\gio-2.0-0.dll.p\gwin32packageparser.c.pdb" /Fogio/gio-2.0-0.dll.p/gwin32packageparser.c.obj "/c" ../gio/gwin32packageparser.c
C:\Program Files (x86)\Windows Kits\8.1\include\winrt\roapi.h(56): error C2016: C requires that a struct or union has at least one member
[6/819] Compiling C object gio/gio-2.0-0.dll.p/gsimpleproxyresolver.c.obj
ninja: build stopped: subcommand failed.

Zueuk avatar Aug 20 '21 20:08 Zueuk

I found that adding a dummy member to the struct in question helps here - but this way we have to hack Windows 8.1 SDK sources, which is not cool.

Perhaps there is some compiler option (/permissive?) that should be used here instead?

Zueuk avatar Nov 25 '21 13:11 Zueuk

I got the problem too. Is there a better solution?

bigvzhang avatar Mar 24 '22 01:03 bigvzhang

You can also typedef these like

typedef struct IUnknown IUnknown;

Still requires editing the SDK headers though...

Zueuk avatar Mar 24 '22 17:03 Zueuk