Page 1 of 1

Clang-cl build error

Posted: 22 May 2025, 13:25
by RT2
Hello,

I'm building NoesisApp for Windows using clang-cl, and everything works well except for a minor issue that's trivial to fix. Here's how to reproduce it:
  • In the NoesisGUI native SDK for Windows (3.2.7), open NoesisApp-vs2022.vcxproj.
  • In the project properties, set the Platform Toolset to LLVM (clang-cl) and Treat Warnings as Errors to No.
  • Build the project. You will encounter the following error:
    expected '(' for function-style cast or type construction (Src\Packages\Render\D3D11RenderDevice\Src\D3D11RenderDevice.cpp, 199)
This is caused by the following line in D3D11RenderDevice.cpp:
viewDesc.Texture2D.MipLevels = unsigned int(-1);
The fix is simply to explicitly use a static cast:
viewDesc.Texture2D.MipLevels = static_cast<unsigned int>(-1);

Re: Clang-cl build error

Posted: 22 May 2025, 15:34
by jsantos
Thanks for reporting! I will fix this

Re: Clang-cl build error

Posted: 27 May 2025, 13:46
by jsantos
Fixed it like this:
        D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc;
        viewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
        viewDesc.Texture2D.MipLevels = (UINT)(-1);
        viewDesc.Texture2D.MostDetailedMip = 0;

Re: Clang-cl build error

Posted: 27 May 2025, 13:49
by RT2
That also works, thanks for the fix.