armory3d / armortools

3D Content Creation Tools
https://armorpaint.org
Other
3.15k stars 332 forks source link

Compilation Issue with VS 2022 #1695

Closed nickenchev closed 4 months ago

nickenchev commented 4 months ago

ArmorPaint version: Latest commit hash is: d9dbdb6

OS/device including version: RX 6750 XT

Issue description: Followed the official build instructions, seeing the following build errors in iron_array.h

1>C:\projects\armortools\armorcore\Sources\iron\iron_array.h(53,24): error C2016: C requires that a struct or union have at least one member
1>(compiling source file '../../armorcore/Sources/iron/iron_array.c')
1>C:\projects\armortools\armorcore\Sources\iron\iron_array.h(54,29): error C2016: C requires that a struct or union have at least one member
1>(compiling source file '../../armorcore/Sources/iron/iron_array.c')

Seems like the C standard doesn't allow for empty structs, which is how they are declared:

typedef struct buffer {} buffer_t;
typedef struct buffer_view {} buffer_view_t;

I've tried switching the C standard (defaults to Legacy MSVC) to C11 and C17 by configuring the project settings in VS2022 but no success. I believe the empty structs are allowed in C++ but not C, and I think this file is being compiled by the Visual C compiler rather than the C++ compiler.

Ran the following prior to opening the solution in VS, had no issues with this:

C:\projects\armortools\armorpaint>..\armorcore\Kinc\make --from ..\armorcore -g direct3d11

Microsoft Visual Studio Community 2022 Version 17.9.1 VisualStudio.17.Release/17.9.1+34616.47 Microsoft .NET Framework Version 4.8.09032

Installed Version: Community

Visual C++ 2022 00482-90000-00000-AA822 Microsoft Visual C++ 2022

WhitleyStriber commented 4 months ago

+1. Also having the same issue. Followed Windows RT instructions:

Severity    Code    Description Project File    Line    Suppression State   Details
Error   C2016   C requires that a struct or union have at least one member  ArmorPaint  C:\Users\whitley\Desktop\armortools\armorcore\Sources\iron\iron_array.h 54      

iconarray.h

typedef struct buffer {} buffer_t; typedef struct buffer_view {} buffer_view_t;

framesbyharsh commented 4 months ago

same here. Severity Code Description Project File Line Suppression State Details Error C2016 C requires that a struct or union have at least one member ArmorLab D:\Studio Work v2\Mirror\armorlab\armortools\armorcore\Sources\iron\iron_array.h 53

luboslenco commented 4 months ago

Should be resolved, thanks for report.

WhitleyStriber commented 4 months ago

TY so much for the patch and for pushing this industry forward.

framesbyharsh commented 4 months ago

Fantastic. Thank you. But... did a git fetch followed by git merge origin/main

and then in Visual studio.. Build| Build Solution... still same error Severity Code Description Project File Line Suppression State Details Error C2016 C requires that a struct or union have at least one member ArmorLab D:\Studio Work v2\Mirror\armorlab\armortools\armorcore\Sources\iron\iron_array.h 53
Severity Code Description Project File Line Suppression State Details Error C2016 C requires that a struct or union have at least one member ArmorLab D:\Studio Work v2\Mirror\armorlab\armortools\armorcore\Sources\iron\iron_array.h 54

typedef struct buffer {} buffer_t; typedef struct buffer_view {} buffer_view_t;

Am I doing something wrong? I am a newbie to GIT so very probable... please help