OSX 10.7.5 + OpenCV 2.4.3:“体系结构x86_64的未定义符号"当使用"cv :: SimpleBlobDetector"时 [英] OSX 10.7.5 + OpenCV 2.4.3: "Undefined symbols for architecture x86_64" when using "cv::SimpleBlobDetector"

查看:85
本文介绍了OSX 10.7.5 + OpenCV 2.4.3:“体系结构x86_64的未定义符号"当使用"cv :: SimpleBlobDetector"时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想玩OpenCVs

I'd like to play around with OpenCVs cv::SimpleBlobDetector, but when compiling my code I get the following error:

Ld /Users/dom/Library/Developer/Xcode/DerivedData/blob-test-opencv-dgtflkyexnsjekbwuxnuoisqknux/Build/Products/Debug/blob-test-opencv.app/Contents/MacOS/blob-test-opencv normal x86_64
    cd /Users/dom/Desktop/blob-test-opencv
    setenv MACOSX_DEPLOYMENT_TARGET 10.7

    /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/dom/Library/Developer/Xcode/DerivedData/blob-test-opencv-dgtflkyexnsjekbwuxnuoisqknux/Build/Products/Debug \
    -L/usr/local/Cellar/opencv/2.4.3/lib \
    -F/Users/dom/Library/Developer/Xcode/DerivedData/blob-test-opencv-dgtflkyexnsjekbwuxnuoisqknux/Build/Products/Debug \
    -filelist /Users/dom/Library/Developer/Xcode/DerivedData/blob-test-opencv-dgtflkyexnsjekbwuxnuoisqknux/Build/Intermediates/blob-test-opencv.build/Debug/blob-test-opencv.build/Objects-normal/x86_64/blob-test-opencv.LinkFileList \
    -mmacosx-version-min=10.7 \
    -fobjc-arc \
    -fobjc-link-runtime \
    -stdlib=libc++ \
    -lopencv_calib3d.2.4.3 \
    -lopencv_contrib.2.4.3 \
    -lopencv_core.2.4.3 \
    -lopencv_features2d.2.4.3 \
    -lopencv_flann.2.4.3 \
    -lopencv_gpu.2.4.3 \
    -lopencv_highgui.2.4.3 \
    -lopencv_imgproc.2.4.3 \
    -lopencv_legacy.2.4.3 \
    -lopencv_ml.2.4.3 \
    -lopencv_nonfree.2.4.3 \
    -lopencv_objdetect.2.4.3 \
    -lopencv_photo.2.4.3 \
    -lopencv_stitching.2.4.3 \
    -lopencv_ts.2.4.3 \
    -lopencv_video.2.4.3 \
    -lopencv_videostab.2.4.3 \
    -framework Cocoa -o /Users/dom/Library/Developer/Xcode/DerivedData/blob-test-opencv-dgtflkyexnsjekbwuxnuoisqknux/Build/Products/Debug/blob-test-opencv.app/Contents/MacOS/blob-test-opencv

Undefined symbols for architecture x86_64:
  "cv::drawKeypoints(cv::Mat const&, std::__1::vector<cv::KeyPoint, std::__1::allocator<cv::KeyPoint> > const&, cv::Mat&, cv::Scalar_<double> const&, int)", referenced from:
      BlobTest::detectBlobs(cv::Mat) in blob-detector.o
  "cv::FeatureDetector::detect(cv::Mat const&, std::__1::vector<cv::KeyPoint, std::__1::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
      BlobTest::detectBlobs(cv::Mat) in blob-detector.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我编写的代码如下:

cv::SimpleBlobDetector::Params params;

params.minDistBetweenBlobs = 10.0;
params.filterByArea = true;
params.minArea = 500.0;
params.maxArea = 1500.0;

cv::SimpleBlobDetector myBlobDetector( params );
std::vector<cv::KeyPoint> myBlobs;

myBlobDetector.detect( image, myBlobs );

cv::Mat blobImg;
cv::drawKeypoints( image, myBlobs, blobImg );

我的标头前缀文件包括OpenCV:

My header prefix file includes OpenCV:

#ifdef __cplusplus
    #import "opencv2/opencv.hpp"
#endif

我正在OSC 10.7.5上通过OpenCV 2.43(通过brew)在4.52上运行Xcode.

I'm running Xcode on 4.52 with OpenCV 2.43 (via brew) on OSX 10.7.5.

据我所知,所有必需的库都已正确链接(尤其是opencv_features2d.2.4.3),并且已为我的64位系统编译了OpenCV.其他OpenCV代码始终可以正常工作...我错过了什么吗?

As far as I can tell all required libs are linked correctly (especially opencv_features2d.2.4.3) and OpenCV is compiled for my 64-bit system. Other OpenCV code has always been working properly … Did I miss something?

推荐答案

在xcode的左侧,选择您的项目名称.在右侧窗口上,转到

On the left hand side of the xcode, select your project name. on the right hand side window, go to

Buil Settings>Build Options> Compiler for C/C++/Objective-C

将其从Apple LLVM Compiler更改为LLVM GCC 4.2.

干杯

Reza

这篇关于OSX 10.7.5 + OpenCV 2.4.3:“体系结构x86_64的未定义符号"当使用"cv :: SimpleBlobDetector"时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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