Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode OSX 10.7.5+OpenCV 2.4.3:使用“cv::SimpleBlobDetector”时的“架构x86_64的未定义符号”_Xcode_Opencv_Osx Lion - Fatal编程技术网

Xcode OSX 10.7.5+OpenCV 2.4.3:使用“cv::SimpleBlobDetector”时的“架构x86_64的未定义符号”

Xcode OSX 10.7.5+OpenCV 2.4.3:使用“cv::SimpleBlobDetector”时的“架构x86_64的未定义符号”,xcode,opencv,osx-lion,Xcode,Opencv,Osx Lion,我想使用OpenCVs,但在编译代码时出现以下错误: 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-ope

我想使用OpenCVs,但在编译代码时出现以下错误:

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)
我正在通过OSX 10.7.5上的brew,使用OpenCV 2.43在4.52上运行Xcode


据我所知,所有必需的库都正确链接,尤其是opencv_功能2D.2.4.3,opencv是为我的64位系统编译的。其他OpenCV代码一直工作正常……我遗漏了什么吗?

在xcode的左侧,选择您的项目名称。在右侧窗口,转至

Buil Settings>Build Options> Compiler for C/C++/Objective-C
将其从Apple LLVM编译器更改为LLVM GCC 4.2

干杯


雷扎

上述答案对我不适用


<> >去构建设置> Apple LLVM 5语言-C++ +C++标准库,选择LBC+++/P>这个解决方案给了我不支持的编译器。这个解决方案导致了更多的未定义的符号,如CV::VoeWrrist::Open…
#ifdef __cplusplus
    #import "opencv2/opencv.hpp"
#endif
Buil Settings>Build Options> Compiler for C/C++/Objective-C