Undefined symbols for architecture i386: for OpenCV project - ios

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
=================================================================
SOLVED
This answer by #karthika has helped me.

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

Related

OpenCV SFM Xcode 7.2: Undefined symbols for architecture x86_64: cv::sfm::reconstruct

I have linked to all the appropriate libraries and headers in my Xcode project (where I have the samples files from OpenCV for scene_reconstruction), after building and installing OpenCV with the contrib module.
I have also applied the #define CERES_FOUND true fix that is recommended here:
https://github.com/Itseez/opencv_contrib/issues/476
The editor prompts me with the correct functions completions from the sfm module and the reconstruct.hpp file (except that the prompts I get have the last boolean is_projective flag missing from all reconstruct()'s i.e.:
one of the prompts is:
reconstruct(<#const std::vector<std::string> images#>, <#OutputArray Rs#>, <#OutputArray Ts#>, <#InputOutputArray K#>, <#OutputArray points3d#>)
I however get:
Undefined symbols for architecture x86_64:
"cv::sfm::reconstruct(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, bool)", referenced from:
_main in scene_reconstruction.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
when I build the project.
I did a camera calibration in the same project and it ran fine, and everything else is alright, I have been using OpenCV built from source for years now, so I've taken care of the basics.
How do I proceed to fix/probe the issue further?
It was an issue with CERES_FOUND not being set because of a version mismatch between eigen and ceres.

Undefined symbols for architecture x86_64: "_sqlite3_close", referenced

I'm new to objective-c and am getting this error when I add from sqlite3 calls in xcode. Any one know what I can do to fix this error?
Undefined symbols for architecture x86_64:
"_sqlite3_close", referenced from:
-[InAppUtils get:] in libInAppUtils.a(InAppUtils.o)
"_sqlite3_exec", referenced from:
-[InAppUtils get:] in libInAppUtils.a(InAppUtils.o)
"_sqlite3_open", referenced from:
-[InAppUtils get:] in libInAppUtils.a(InAppUtils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried adding the libsqlite3.dylib library but I can't find it on my system. Is it required? If so, how do I find it?
It looks like libsqlite3.tbd is the new libsqlite3.dylib. I added it and everything worked.
Go to the Build Phases tab. Expand the "Link Binary with Libraries" section. Click on the + icon. Search for "sqlite". Add the library

Linking Errors while generating SDK

I am trying to generate SDK in that am using audio related framework ,when compiling code am getting below linking errors .Any help for solving these issues.
Undefined symbols for architecture armv7:
"_vDSP_ztoc", referenced from:
FFTRealCalculator::InverseFFT_A(ComplexSplit*, float*, int) in libEywaSDK.a(FFTRealCalculator.o)
"_vDSP_ctoz", referenced from:
FFTRealCalculator::ForwardFFT_A(float const*, unsigned long, ComplexSplit*) in libEywaSDK.a(FFTRealCalculator.o)
"_vDSP_fft_zrip", referenced from:
FFTRealCalculator::ForwardFFT_A(float const*, unsigned long, ComplexSplit*) in libEywaSDK.a(FFTRealCalculator.o)
FFTRealCalculator::InverseFFT_A(ComplexSplit*, float*, int) in libEywaSDK.a(FFTRealCalculator.o)
"_vDSP_create_fftsetup", referenced from:
FFTRealCalculator::Initialize(unsigned char) in libEywaSDK.a(FFTRealCalculator.o)
"_vDSP_destroy_fftsetup", referenced from:
FFTRealCalculator::~FFTRealCalculator() in libEywaSDK.a(FFTRealCalculator.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
These symbols come from Accelerate Framework
I suspect you need to add this to your project.
Go to targets -> Valid Architectures & Remove armv7.
Clean your project & build
Hope it will work for you.

Apple Mach O Link Key failed when compiling GooglsMaps.Framework

I have tried to add all GoogleMaps.Framework and GoogleMaps.bundle at the framework
When it comes to the execution, it causes the following error
I have no clue on what happens exactly. Would you please tell me the proper way to add Google MAP SDK frameworks instead ?
I have even added the framework libc++.dylib.
The error message
Undefined symbols for architecture i386:
"_CGImageSourceCreateImageAtIndex", referenced from:
_GMSCreateCGImageWithData in GoogleMaps(GMMImageSupport.o)
"_CGImageSourceCreateWithDataProvider", referenced from:
_GMSCreateCGImageWithData in GoogleMaps(GMMImageSupport.o)
"_GLKMatrix3Identity", referenced from:
gmscore::vector::GLLineGroup::SetTransform(gmscore::math::Matrix4f const&, gmscore::base::reffed_ptr<gmscore::vector::Camera> const&) in GoogleMaps(GLLineGroup.o)
"_GLKMatrix4Invert", referenced from:
-[GMSStreetViewView fadeOutLastScene] in GoogleMaps(GMSStreetViewView.o)
gmscore::streetview::Camera::Unproject(gmscore::math::Vector2f const&, bool*) const in GoogleMaps(Camera-B046EE312980DB98.o)
gmscore::vector::Camera::UpdateInternals() in GoogleMaps(Camera-3E3856CABC8A9C74.o)
gmscore::renderer::Camera3D::SetTransform(gmscore::math::Matrix4f const&) in GoogleMaps(Camera3D.o)
gmscore::renderer::Camera3D::Transform() in GoogleMaps(Camera3D.o)
non-virtual thunk to gmscore::renderer::Camera3D::Transform() in GoogleMaps(Camera3D.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Double check if you have all these frameworks on your Xcode Project
AVFoundation.framework
CoreData.framework
CoreLocation.framework
CoreText.framework
GLKit.framework
ImageIO.framework
libc++.dylib
libicucore.dylib
libz.dylib
OpenGLES.framework
QuartzCore.framework
SystemConfiguration.framework
Please visit:-
https://developers.google.com/maps/documentation/ios/start#getting_the_google_maps_sdk_for_ios
to learn step by step instructions on Adding the Google Maps SDK for iOS to your project.
Most likely you forget to add ImageIO.framework

compilation error when using boost framework and opencv in ios project

I need to use boost framework in my iOS project. My first mission was getting boost to work for Ios. I tried using this script
http://goodliffe.blogspot.co.uk/2010/09/building-boost-framework-for-ios-iphone.html
but wasn't able to build due to lipo errors (?) and couldn't figure out how to solve it. I looked for a precompiled framework and came accross this project on github:
https://github.com/danomatika/ofxLua
There is an Ios version of boost included in the lib section. So I tried using it in my project
but now when I build my project I am getting these errors:
Undefined symbols for architecture i386:
"vtable for boost::filesystem::detail::utf8_codecvt_facet", referenced from:
(anonymous namespace)::path_locale() in boost(path.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"_inflate", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
"_inflateEnd", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
"_inflateInit_", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also want to make clear that I installed boost using
sudo port install boost
and under my xcode project I am not linking to /usr/local/include/boost/ or something like that. It seems that it is compiling with incorrect architecture.
Any solution for this? Maybe the framework isn't compiled for Ios? Or is my project not referencing the correct version
You can use the BOOST 1.57.0 with ofxiOSBoost static libraries and headers:
https://github.com/danoli3/ofxiOSBoost
Releases for libc++ (c++11), libstdc++.
All build scripts are in the /scripts folder (updated Peter Goodliffe script)

Resources