c++ - 在 IOS 中使用 OpenCV
<p><p>我正在尝试在我的 IOS 应用程序中使用 OpenCV 库。我已经使用 <code>pods</code> 安装了它,当前版本是 2.4.13。在 PrefixHeader.pch 文件中,我包含了 </p>
<pre><code>#ifndef _cplusplus
#import <opencv2/opencv.hpp>
#endif
</code></pre>
<p>在我的 <code>ViewController.m</code> 文件中,当我添加行 <code>#import "opencv2/highgui/ios.h"</code> 时,我得到构建错误</p>
<pre><code>Parse Issue. Expected ')' ios.h.
</code></pre>
<p>这个 ios.h 文件包含在库中,所以我没有修改它及其内容:</p>
<pre><code>#include "opencv2/core/core.hpp"
#import "opencv2/highgui/cap_ios.h"
UIImage* MatToUIImage(const cv::Mat& image);
void UIImageToMat(const UIImage* image,
cv::Mat& m, bool alphaExist = false);
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>根据<a href="http://docs.opencv.org/2.4/doc/tutorials/ios/hello/hello.html#opencvioshelloworld" rel="noreferrer noopener nofollow">documentation</a>对于较新的 XCode 和 IOS 版本,您需要将 *.m 文件更改为 *.mm。尝试将 <code>ViewController.m</code> 重命名为 <code>ViewController.mm</code> 看看是否可行。 </p></p>
<p style="font-size: 20px;">关于c++ - 在 IOS 中使用 OpenCV,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/44473891/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/44473891/
</a>
</p>
页:
[1]