Why so: constexpr RECT DefaultRS = { 0,0,180,52 }; You can, and here is the constexpr D3DXVECTOR3 DefaultCenter = { 0,0,0 }; can't

Added error text: error C2127: "DefaultCenter": invalid initialization of the "constexpr" entity using a non-constant expression

  • Maybe bring the text of the error? - Unick
  • error C2127: "DefaultCenter": invalid initialization of the "constexpr" entity using a non-constant expression - K2Re8
  • What are you compiling C ++ 11, C ++ 14, C ++ 17? - Unick
  • c ++ 17, it seems to be ... - K2Re8
  • one
    Apparently you need to use D3DVECTOR, because This is a simple type, and D3DXVECTOR3 in your case is most likely a complex type with constructors, etc .. - Unick

1 answer 1

In the D3DXVECTOR3 class D3DXVECTOR3 all constructors are not constexpr . Actually, they are part of the outdated DirectX9X API, which appeared before the appearance of constexpr in the language.