2

I am trying to build this project, but its display below error,

Undefined symbols for architecture i386:
  "cv::merge(std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::_OutputArray const&)", referenced from:
      -[RRMainViewController colorSobelEdge:isVertical:] in RRMainViewController.o
  "cv::split(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >&)", referenced from:
      -[RRMainViewController colorSobelEdge:isVertical:] in RRMainViewController.o
  "cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)", referenced from:
      -[RRMainViewController floodFillPostprocess:WithColor:] in RRMainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have added OpenCV.framework and added this line in .pch file

#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif

Added this library in project

libstdc++.6.0.9.dylib
libc++.dylib
libz.1.2.5.dylib

But still got above error.. please help... thanx in advance..

Here is the screenshot for my Build phase

enter image description here

=================================================================
SOLVED
This answer by @karthika has helped me.

Community
  • 1
  • 1
  • Downvoter please leave comment so we know what is the problem in this question. –  Apr 14 '14 at 10:57
  • It seems it can not find the directory of your opencv file? Did you check the path? – Hadi Apr 14 '14 at 12:55
  • @Constantine I have added Opencv.framework in root folder so changed framework search path to root and Directory not found error gone but still got error for Opencv. –  Apr 14 '14 at 13:04

1 Answers1

0

Opencv framework or some other files are not added in the build phases. Go to project settings->Build phases->Link binary with libraries and check if opencv exists in the list. Otherwise click on + and add it Then go in the build phases to compile sources and make sure RRMainViewController.m is present in the list. Otherwise click on + and add it

This answer may help you too: Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

Community
  • 1
  • 1
Khawar Ali
  • 3,462
  • 4
  • 27
  • 55
  • Thanx for answer. Both files are present in the build path. Please see the screenshot –  Apr 14 '14 at 13:26
  • Just try one more thing, click on your class name `RRMainViewController.m` in the left panel and change the extension to .mm i.e `RRMainViewController.mm`. Some times C++ code needs the extension .mm to run even if the class code is written in objective-c but opencv is in c++ – Khawar Ali Apr 14 '14 at 13:29
  • Thanx for the Suggestion, Tried that to doesnt affect anything.. :( –  Apr 14 '14 at 13:30