compile error when using cv::minMaxLoc() on iOS - iphone

I am using OpenCV on iOS, the project works fine and can detect harris corners but when I try to use the following line I get a compile error:
cv::minMaxLoc(cornerStrength,&minStrength,&maxStrength);
The error from xcode is:
Undefined symbols for architecture armv7:
"___udivmodsi4", referenced from:
cv::minMaxIdx(cv::_InputArray const&, double*, double*, int*, int*, cv::_InputArray const&)in OpenCV(stat.o)
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Any advice much appreciated as I cant find a way past this at the moment.
Cheers,
Fraser

If you are using LLVM GCC 4.x, try changing the compiler to Apple LLVM 3.x, that did the trick for me.

Related

Undefined symbols when building Poco for iPhone Simulator

I am having these link errors when building an Xcode 6.1.1 project for Simulator that links with Poco 1.6.0. OSX is 10.10.1 Yosemite.
Undefined symbols for architecture x86_64:
"_opendir$INODE64", referenced from:
Poco::DirectoryIteratorImpl::DirectoryIteratorImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libPocoFoundation.a(DirectoryIterator.o)
"_readdir$INODE64", referenced from:
Poco::DirectoryIteratorImpl::next() in libPocoFoundation.a(DirectoryIterator.o)
ld: symbol(s) not found for architecture x86_64
Questions:
Why is x86_64 architecture needed for the simulator?
Why can't these symbols be resolved?
Thanks in advance.

zbar sdk view third party library error in Xcode 5

I am using z bar SDK in x code 5 when i am archiving its getting following errors
Undefined symbols for architecture armv7:
"_CMSampleBufferGetImageBuffer", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferIsValid", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferDataIsReady", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferGetNumSamples", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems you missed the one of the frameworks - Core Media.
Check the following integration link for ZBar sdk.
http://zbar.sourceforge.net/iphone/sdkdoc/install.html#integration
Remove armv7s arm64 Architectures only use the armv7 and solve your problem.
Project -> Build Settings -> Architectures -> Delete armv7s arm64
Importing a header and do not linking against the correct library will cause that error. Check you have imported the correct libraries. A more complete answer can be found here
Undefined symbols for architecture armv7

XCode 4.3.3 sqlite3 error even after importing and including frameworks

When I run my XCode project using sqlite3, I keep getting the same two errors (appearing between **):
Undefined symbols for architecture i386:
**"_OBJC_CLASS_$_CalendarDatabase", referenced from: objc-class-ref in AppDelegate.o**
ld: symbol(s) not found for architecture i386
clang: error: **linker command failed with exit code 1 (use -v to see invocation)**
I looked everywhere for an answer but all I find is problems with importing sqlite3 and including frameworks. But I've included libsqlite3.0.dylib and libsqlite3.dylib and I've imported sqlite3 using #import "sqlite3.h". I'm still getting these errors. What could be the problem?
In the error message, the words for architecture i386 tells me that your dylibs do not have i386 code (only x86_64). If you're compiling for i386 (32 bits), you'll need either fat dylibs (x86_64 + i386), or 32-bit dylibs.

Undefined symbols for architecture i386: "_PerformXMLXPathQuery"

I looked at all the others that had a similar title but none of those solutions worked for some reason... Hoping someone can help!
Undefined symbols for architecture i386:
"_PerformXMLXPathQuery", referenced from:
-[WeatherForecast connectionDidFinishLoading:] in WeatherForecast.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"_PerformXMLXPathQuery", referenced from:
-[WeatherForecast connectionDidFinishLoading:] in WeatherForecast.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am new to iOS so any help would be greatly appreciated!!
Seems like you are compiling for the simulator (i386) with a library for the Device (ARM). Either compile for the device and run on it or get an i386 version of the library and run with it on the simulator.
For those who need it, the issue was that my XPathQuery.m file was not in the Complied Sources list. It was as simple as that!
Just posting this for future reference! Hope it helps someone!

Wierd error when trying to run app with AdMob

Undefined symbols for architecture i386:
"_AudioServicesPlaySystemSound", referenced from:
-[GADWebViewDelegate webView:shouldStartLoadWithRequest:navigationType:] in libGoogleAdMobAds.a(GADWebViewDelegate.o)
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does it means? what do I need to do in order to fix that?
Thanks alot.
FYI - I had to add the AudioToolbox framework to get this to compile.
The solution was to add AVAudioPlayer and MessageUI frameworks. That's about it.
From where ever you have got the library that you are using, its only compiled to be used on the device.. (architecture armv7), where as you are trying to test it on the simulator (architecture i386) thus the error. So if you want to test it on the simulator, get a version of the library which is compiled for i386.
You can also combine both the libraries using lipo command and use it on any architecture..
hoping this helps.. :)