在 Visual Studio 2015 Update 3 中使用 OpenCV 3.2 和目标 x64(3.2 版本中没有 x86 库)构建简单的 OpenCV 应用程序时,出现以下错误:
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(100): error C2737: 'std::is_same_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(100): error C2998: 'const bool std::is_same_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(245): error C2737: 'std::is_integral_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(245): error C2998: 'const bool std::is_integral_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(282): error C2737: 'std::is_floating_point_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(282): error C2998: 'const bool std::is_floating_point_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(295): error C2737: 'std::is_arithmetic_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtr1common(295): error C2998: 'const bool std::is_arithmetic_v': cannot be a template definition
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstddef(697): error C2737: 'std::is_function_v': 'constexpr' object must be initialized
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstddef(697): error C2998: 'const bool std::is_function_v': cannot be a template definition
不知怎的,我不认为这是 OpenCV 的问题,所以我想我在构建过程中遗漏了一些东西或者配置错误。任何应该改变的建议都值得赞赏:)
我关注了以下网站http://opencv-srf.blogspot.com/2013/05/installing-configuring-opencv-with-vs.html http://opencv-srf.blogspot.com/2013/05/installing-configuring-opencv-with-vs.html当谈到如何配置VS的建议时。
添加源代码,尽管我相信这与构建的配置有关,而不是源代码:
#include "opencv2/opencv.hpp"
int main()
{
return 0;
}
通过 Nuget 添加 OpenCV 3.1 时出现相同的错误,如中所述OpenCV 通过 NuGet 包与 Visual Studio 2015 一起使用,如何配置? https://stackoverflow.com/questions/42317398/opencv-via-nuget-packages-with-visual-studio-2015-how-to-configure/42324201#comment73139150_42324201。有趣的是,它看起来像是在完全不同的情况下出现的类似错误 -Visual Studio 2015:C++ REST API (Casablanca) 在 VS inlcudes/headers 中编译失败 https://stackoverflow.com/questions/38747680/visual-studio-2015-c-rest-api-casablanca-failing-compilation-in-vs-inlcudes通过将 VS2015 从 RC 重新安装到完整社区版本来解决。我正在使用 VS2015 Enterprise Update 3 所以我希望这不是根本原因......
这个问题显然是由VS2015的问题引起的。至少在我修复了 VS2015 安装之后(来自Program and Features
在 Windows 中,问题就消失了)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)