I’m getting the following errors when compiling a C++ app in Visual Studio 2022 (C++ 17 standard). Note that this is just a small excerpt; many other related or similar errors follow.
1>------ Build started: Project: Jeweligami.BackOffice, Configuration: Debug x64 ------
1>ImageProcessor.cpp
1>F:\$oftware\Framework\OpenSource\OpenCV\build\include\opencv2\core\cvstd.hpp(135,51): error C2760: syntax error: 'static_cast' was unexpected here; expected 'type specifier'
1>(compiling source file '/ImageProcessor.cpp')
1>F:\$oftware\Framework\OpenSource\OpenCV\build\include\opencv2\core\cvstd.hpp(135,51):
1>the template instantiation context (the oldest one first) is
1> F:\$oftware\Framework\OpenSource\OpenCV\build\include\opencv2\core\cvstd.hpp(139,2):
1> see reference to class template instantiation 'cv::Allocator<_Tp>' being compiled
1>F:\$oftware\Framework\OpenSource\OpenCV\build\include\opencv2\core\cvstd.hpp(135,51): error C2760: syntax error: 'static_cast' was unexpected here; expected ')'
Here’s a snippet of cvstd.hpp (in OpenCV\build\include\opencv2\core), around the area where the error was flagged (line 135, char 51):
Also, I’m not building static libraries, but rather, I’m trying to use the pre-built DLLs - I’ve done the minimal installation required, i.e. configuring OpenCV_DIR environment setting, as well as specifying the OpenCV\build\include in my INCLUDE path.
I’ve never encountered this error in VC++ before; wondering if anyone would know what setting(s) I need to set/unset in order to resolve it. Unfortunately, I can’t drop to a lower standard (like 11) if that’s what’s needed - although the lowest standard available in my platform is 14, the app actually requires at least 17.
Regards,
-JL