0

我正在关注这个: http ://sadeepj.blogspot.com.br/2012/03/installing-and-configuring-opencv-to.html

我有一个问题,编译。但我已经修复了它,修改了2个文件......

现在我正在尝试运行该示例。

我收到此错误消息:

ld /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2 normal x86_64 cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2 setenv MACOSX_DEPLOYMENT_TARGET 10.8 /Applications/Xcode.app/Contents/ Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8。sdk -L/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug -F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug -文件列表 /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList -mmacosx-version-min=10.8 - stdlib=libc++ -lopencv_core.2.4.6 -lopencv_highgui.2.4.6 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2。构建/对象-正常/x86_64/DemoOpenCV2_dependency_info。dat -o /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2

ld:找不到 -lopencv_core.2.4.6 的库 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我已经遵循所有步骤。我什至无法建造它。请帮我。

[在有人说这是重复的帖子之前,我知道,这是原始的: C++ linker errors with OpenCV。对不起。但我什至不能评论那个:/]

4

1 回答 1

1

哇,终于解决了:

一些考虑:

  • 意识到即使它正在寻找 -l opencv_core.2.4.6,编译器也会得到正确的文件,如果它用其他名称正确添加,在这种情况下是 libopencv_core.2.4.dylib
  • 我正在使用Project>Add files to... 添加文件,然后创建一个组并将文件拖到组中。这弄乱了Project>Link Binary with Libraries中的链接。所以我不得不再次将组中的文件拖到那个位置。

在这些事情之后,我遇到了两个文件(core 和 highgui)和 4 个错误的情况:

ld /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2 normal x86_64 cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2 setenv MACOSX_DEPLOYMENT_TARGET 10.8 /Applications/Xcode.app/Contents/ Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/eduardoreis /Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug -L/Users/eduardoreis/Downloads/opencv-2.4.6.1/build/lib/Debug -L/usr/local/lib/python2.7 /site-packages -L/usr/local/lib/python2.7/site-packages/PyQt4 -L/usr/local/lib/wine -L/usr/local/Cellar/wine/1.4.1/lib -L /usr/local/Cellar/qt/4.8.5/lib -L/usr/local/Cellar/qscintilla2/2.7.1/lib -L/usr/local/Cellar/libicns/0.8.1/lib -L/usr/local/Cellar/jasper/1.900.1/ lib -L/usr/local/Cellar/jpeg/8d/lib -L/usr/local/Cellar/little-cms/1.19/lib -L/usr/local/Cellar/libpng/1.5.14/lib -L/ usr/local/Cellar/libtiff/4.0.3/lib -F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug -F/usr/local/lib -filelist /Users/ eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ - lopencv_core.2.4 -lopencv_highgui.2。4 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2_dependency_info.dat -o /用户/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2

架构 x86_64 的未定义符号:
“cv::namedWindow(std::__1::basic_string, std::__1::allocator > const&, int)”,引用自:main.o 中的 _main “cv::imread(std: :__1::basic_string, std::__1::allocator > const&, int)",引用自:main.o 中的 _main "cv::imshow(std::__1::basic_string, std::__1::allocator > const&, cv::_InputArray const&)”,引用自:main.o 中的 _main ld:未找到架构 x86_64 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

然后(感谢上帝和几天的谷歌搜索)我得到了这个:

选择您的项目,转到Build Settings 选项卡,按c++ 标准库过滤,并将此参数设置为libstdc++(GNU C++ 标准库)。

来自:在 Xcode 中链接 OpenCV 时架构 x86_64 错误的未定义符号

最后在我的代码环境中又是晴天......

于 2013-10-22T15:33:35.577 回答