Opencv warning on visual studio 2022

Just build it on visual studio 2022 and you will see warning.

And I want to close these warning or solve it.

It show the C:\opencv\include\opencv2\core\matx.inl.hpp
I don’t know where it is be used for matx.inl.hpp on the git project

please show us . else we cannot help !

(please paste the exact warning, along with the exact code line here)

also, which opencv version is it ?

build with x64-Release
4.10.0

first, please do not post screenshots of your ide here, but TEXT, ty.

however, it seems, you found a (minor) bug in the MatStep code,
which can be even reproduced w/o opencv headers as a MRE :

struct MatStep {
  size_t *p;
  size_t buf[2];
  MatStep() {
      p = buf; // problem is here, buf is not initialized
      p[0] = p[1] = 0;
  }
};

int main() { MatStep m; return 0;} 

though it’s already mentioned here,
maybe raise a new issue on gh ?
(also see discussion here)

again, it’s a minor warning, and imho you’re safe to ignore it in your code

thanks for the report, nonetheless ! :wink:

Thanks,
Yes, it is just a warning, do you have the method to close opencv warning?
I can’t ignore the warning because I want to use the warning windows on vs 2022 IDE
to develop my code.

imo you got 2 options:

  • fix the library (for everyone, the proper way)
    (that is: raise an issue, start a disussion, send a pr with a fix)
    maybe just changing the order does it:

    MatStep() {
        buf[0] = buf[1] = 0;
        p = buf; 
    }
    
  • suppress the warning (terrible idea, otherwise):
    add a #pragma warning( disable: 26495 ) before including opencv headers

besides that:

this is not a valid argument.