Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Zueuk opened this issue Aug 20, 2021 · 3 comments
Open

Comments

@Zueuk
Copy link

Zueuk commented Aug 20, 2021

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
Copy link
Author

Zueuk commented Nov 25, 2021

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?

@bigvzhang
Copy link

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

@Zueuk
Copy link
Author

Zueuk commented Mar 24, 2022

You can also typedef these like

typedef struct IUnknown IUnknown;

Still requires editing the SDK headers though...

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

No branches or pull requests

2 participants