通过Xcode在OS X 10.11上构建OpenCV程序时出错

时间:2016-02-02 03:26:21

标签: c++ xcode macos opencv

我按照这些说明在Mac上安装和构建OpenCV 3:http://blogs.wcode.org/2014/10/howto-install-build-and-use-opencv-macosx-10-10/

我已成功构建了该文章底部的示例程序(来自命令行)。

然后我在这里关注了作者的第二篇文章:http://blogs.wcode.org/2014/11/howto-setup-xcode-6-1-to-work-with-opencv-libraries/ - 我注意到我使用的是Xcode 7.2而不是6.1,但是所有的对话框和步骤似乎都运行正常。< / p>

......除了建筑。

使用上面文章中包含的简单C ++程序,我得到了这些构建错误:

Xcode显示20个错误全部来自表单的body { font-family: 'Lucida Grande', Verdana, Arial; font-size: 12px; } #stage { margin: 80px auto; width: 600px; height: 400px; perspective: 5000; } #rotate { margin: 0 auto; width: 600px; height: 400px; } .ring { margin: 0 auto; height: 110px; width: 600px; -webkit-transform-style: preserve-3d; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: linear; } .ring > :nth-child(odd) { background-color: #995C7F; } .ring > :nth-child(even) { background-color: #835A99; } .poster { position: absolute; left: 250px; width: 100px; height: 100px; opacity: 1; color: rgba(0,0,0,1); -webkit-border-radius: 10px; } .a { transform: rotateX(0deg) translateZ(40px); } .b { transform: rotateX(120deg) translateZ(40px); } .c { transform: rotateX(240deg) translateZ(40px); } .done { transform: rotate(0deg); } .poster > p { font-family: 'Georgia', serif; font-size: 36px; font-weight: bold; text-align: center; margin-top: 28px; } #ring-1 { -webkit-animation-name: x-spin; -webkit-animation-duration: .6s; } #ring-2 { -webkit-animation-name: back-y-spin; -webkit-animation-duration: 4s; } #ring-3 { -webkit-animation-name: y-spin; -webkit-animation-duration: 3s; } @-webkit-keyframes x-spin { 0% { -webkit-transform: rotateX(360deg); } 50% { -webkit-transform: rotateX(180deg); } 100% { -webkit-transform: rotateX(0deg); } } @-webkit-keyframes y-spin { 0% { -webkit-transform: rotateY(0deg); } 50% { -webkit-transform: rotateY(180deg); } 100% { -webkit-transform: rotateY(360deg); } } @-webkit-keyframes back-y-spin { 0% { -webkit-transform: rotateY(360deg); } 50% { -webkit-transform: rotateY(180deg); } 100% { -webkit-transform: rotateY(0deg); } }

cstring.h

它还在/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:70:9: No member named 'memcpy' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:71:9: No member named 'memmove' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:72:9: No member named 'strcpy' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:73:9: No member named 'strncpy' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:74:9: No member named 'strcat' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:75:9: No member named 'strncat' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:76:9: No member named 'memcmp' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:77:9: No member named 'strcmp' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:78:9: No member named 'strncmp' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:79:9: No member named 'strcoll' in the global namespace; did you mean 'strtoll'? /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:80:9: No member named 'strxfrm' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:82:9: No member named 'memchr' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:84:9: No member named 'strchr' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:86:9: No member named 'strcspn' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:88:9: No member named 'strpbrk' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:90:9: No member named 'strrchr' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:92:9: No member named 'strspn' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:94:9: No member named 'strstr' in the global namespace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:98:87: No member named 'strchr' in the global namespace; did you mean simply 'strchr'? 文件中给了我错误:

main.cpp

...我可以通过在/Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:14:14: Invalid operands to binary expression ('ostream' (aka 'int') and 'const char *') /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:29:16: Variable has incomplete type 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:30:14: Invalid operands to binary expression ('ostream' (aka 'int') and 'const char *') /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:49:38: No viable conversion from 'cv::Mat' to 'const cv::_InputArray' /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:50:26: Invalid operands to binary expression ('ostream' (aka 'int') and 'const char *') /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:66:17: Variable has incomplete type 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') /Users/me/src/opencv-me-2/OpenCVTest/OpenCVTest/main.cpp:71:14: Invalid operands to binary expression ('ostream' (aka 'int') and 'const char *') 行之后添加#include <string>来消除这些问题。然而,&#34;没有名为&#39; memcpy&#39;在全局命名空间&#34;错误仍然存​​在。

更新

这是我的最小工作示例文件:

main.cpp中
#include <stdio.h>

当我构建它时,我在#include <opencv2/imgcodecs.hpp> #include <opencv2/videoio/videoio.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include <stdio.h> #include <string> using namespace cv; using namespace std; int main(int ac, char** av) { return 0; } 中得到了相同的20个错误 - 我的cstring文件没有直接引用它。 Xcode报告包含跟踪是:

main.cpp

0 个答案:

没有答案