OpenCV UWP构建失败 [英] OpenCV UWP build fails

查看:90
本文介绍了OpenCV UWP构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我克隆了OpenCV的官方github存储库,并使用CMake生成了VS解决方案.

I cloned the official github repo of OpenCV and used CMake to generate the VS Solution.

 cmake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" .

如您所见,我想为UWP 32位构建OpenCV.在VS 2015中构建时,opencv_core模块失败,并显示以下信息:

As you can see, I want to build OpenCV for UWP 32-Bit. When building in VS 2015 the opencv_core module fails with:

Error   C2664   'BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES)': cannot convert argument 1 from 'wchar_t [260]' to 'LPCSTR'
Error   C2039   'CreateFileA': is not a member of '`global namespace''  
Error   C3861   'CreateFileA': identifier not found
Error   C2664   'DWORD GetTempPathW(DWORD,LPWSTR)': cannot convert argument 2 from 'char [261]' to 'LPWSTR'

所有这些错误都在文件"filesystem.cpp"中的opencv_core中.知道如何解决这些问题.这些问题可能与Windows 10 SDK有关吗?

All these error are in the opencv_core in the file "filesystem.cpp. Now, I already successfully build it a few weeks ago, before I had to reformat my pc. Now it just won't build and I don't know how to fix these. Could these problems be related to the Windows 10 SDK?

推荐答案

好像您正在混合UNICODE和非UNICODE构建.确保它们是一致的,并且您使用了正确的字符串类型(如果愿意,请使用TEXT()宏).

Looks like you are mixing UNICODE and non-UNICODE builds. Make sure they're consistent and that you use the correct type of strings (use the TEXT() macro if you like).

要进行验证,请在VS中右键单击项目,然后选择属性,然后展开 C/C ++ -> 预处理器,然后选中预处理器定义.单击值旁边的向下箭头,然后单击< edit> ,然后确认同时定义了UNICODE_UNICODE.如果没有,请添加它们.您需要为每个配置重复此操作(您可以尝试选择全部",但是如果您有相互冲突的选项,可能会弄乱事情).

To verify, right-click the project in VS and choose Properties and then expand C/C++ -> Preprocessor and check the Preprocessor definitions. Click the down-arrow next to the value and click <edit> and then verify the both UNICODE and _UNICODE are defined. If not, add them. You need to repeat this for each configuration (you can try and select "all" but that might mess things up if you have conflicting options).

对于最后一个错误,请将声明从char更改为wchar_t进行编译.

For the last error, change the declaration from char to wchar_t to compile.

这篇关于OpenCV UWP构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆