What a pain! I’ve upgraded Visual Studio 2019 to Version 16.8.3, and it took me a while to find out that’s unveiled a bug in the code.
As you’ve seen from my prior blogs, Explorations in 3D Graphics and DirectX 12: Episode 1 and Explorations in 3D Graphics and DirectX 1w Episode 2: Video of Episode 1, I’ve been playing around with the demonstration examples in Frank D. Luna’s book, and having some great fun. But, then, a new bug emerged.
There are 23 chapters in the book 3D Game Programming with DirectX 12 by Frank D. Luna; most of which have little demo programs that you can download, import into Visual Studio, compile and run. The first 80 pages of the book crawl (slowly) through some of the math needed for 3D graphics: Vector Algebra, Matrix Algebra, Transformations, etc., and it’s pretty heavy going. To keep myself entertained in the meantime, I’m skipping ahead and honing my C++ and Visual Studio skills by working with the demo programs. I’ve actually learned a lot, as you can see by the prior two blogs, by overcoming some shortcomings in the programs introduced in the four years or so since the book was published.
I got up to Chapter 10 of the book’s demo programs when I hit a snag: even after applying all the workarounds I found out about, I got some new errors when I compiled a “Blending” demo application:
There are a bunch of C2102 “‘&’ requires l-value” errors coming out of the program compile. I worked my way through the code, pulling my hair out, until I found someone else with the same problem https://github.com/microsoft/directx-graphics-samples/issues/652 dated September 22, 2020. It turns out that some Visual C++ updates for the latest release changed something called “/permissive-“. Luna’s code is non-conforming to the new update: specifically, we’re using r-values and not l-values in these lines of the software.
So, problem easily solved! I right-clicked on the Project, chose Properties, then C/C++ -> Language and changed Conformance mode from “Yes” to “No”.
Then my program ran nicely:
Whew! This is probably not the best way to solve the C2102 errors, though. I’ll explore the code a little more, and introduce some fixes that address the VC++ updates for /permissive-.