[Direct3D12, v3] Not compiling due to syntax errors
Closed this issue · 6 comments
Describe the bug
The Direct3D12 backend fails to compile due to syntax errors, probably because of improper C-style zero initialization like here:
To Reproduce
- Attempt a build of 01_triangle from Kore Samples 4b86b45 with kmake.exe --compile targeting the Direct3D12 graphics backend
- Compilation should fail
Expected behavior
Compiled output.
Execution Environment:
- Host system (where you compile your code): Win10
- Target system (where you run your code): Win10
- IDE and/or compiler used: VS2022 17.5.5
- Kore revision: 285eb52
- Application output (if it runs): Compilation Failure
- Kore build output:
Using Kore (285eb527) from C:\Work\kinc_tools\Kore-Samples\kore
kfile found.
Creating Windows project files.
Project changed, writing project files.
Compiling...
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.5.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
MSBuild version 17.5.1+f6fdcf537 for .NET Framework
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(568,50): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(583,65): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(597,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(605,65): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(619,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\commandlist.c(665,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\descriptorset.c(38,43): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\descriptorset.c(55,51): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\descriptorset.c(69,42): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\descriptorset.c(99,42): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\descriptorset.c(128,42): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(107,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(115,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(123,36): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(149,38): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(170,45): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(191,38): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(203,38): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(239,30): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(765,29): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(792,50): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(807,65): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(814,73): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(865,65): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(872,73): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
1>C:\Work\kinc_tools\Kore-Samples\kore\backends\gpu\direct3d12\sources\device.c(893,32): error C2059: syntax error: '}' (compiling source file ..\..\kore\backends\gpu\direct3d12\sources\d3d12unit.c) [C:\Work\kinc_tools\Kore-Samples\01_triangle\build\01_triangle.vcxproj]
Build time: 0m 1s
Compilation failed.
Error: Compile errorShould indeed be {0} but it's compiling fine in VS2022 (see https://github.com/Kode/Kore/actions and https://github.com/Kode/Kore-Samples/actions). How exactly do you compile it? Still using VS2019 maybe?
PS: Please use the issue-template next time, makes things easier for both of us.
Sorry about that; I figured this one would be open and shut but I guess I really can't ever assume can I. You're right.
It's VS2022 Version 17.5.5 so it's out of date by quite a bit. I don't do anything special, just fully updated kore + kore_samples calling kmake with --compile. I have a guess here looking into it: it looks like the C23 standard might permit bla = {} which is maybe why that works with the newer tools. https://en.cppreference.com/w/c/compiler_support/23 says it doesn't though.
It's too late now but I went ahead and updated the issue to follow your template anyway.
The GitHub actions also simply do --compile, things are not set to C23. And a local --compile of 01_triangle also works fine for me. Maybe the old Visual Studio revision is indeed the problem. First time I see that happen though, that they change what code compiles with a patch release. Scary. Is there a reason you stay on that old version? Do not want to put pressure on you to update but it would be good to know if that's it.
Yeah it's going to break a bunch of hardcoded batch files I have to do some things but whatever
Guess what?
Using Kore (285eb527) from C:\Work\kinc_tools\Kore-Samples\kore
kfile found.
Creating Windows project files.
Project changed, writing project files.
Compiling...
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.14.2
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
MSBuild version 17.14.8+a7a4d5af0 for .NET Framework
Build time: 0m 3s
Done.Oh no. Microsoft, what are you doing?
I fixed those now but unfortunately I do not know of a good way to ensure compatibility with old Visual Studio revisions in the future. But I'm also sending an angry mail to Bill Gates, maybe that will help.
Meanwhile, maybe vswhere can help you with your scripts, it's always located at "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" and can figure out the current revision for you.