I try to create opencv frame work following this instruction
I don't know why but i got an empty framework. I download a framework separately. I add it correctly....everything is fine. But when i type (for example):
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "stdio.h"
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
cvNamedWindow("Wi", CV_WINDOW_NORMAL);
}
i got this error:
Undefined symbols for architecture i386:
"_cvNamedWindow", referenced from:
_main in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Maybe somebody knows how to solve this problem. Or maybe anyone has a correctly framework. Plz, send me a link to download a correct framework. I spent many times with it. Help anybody
Here are some small working iOS example projects compatible with XCode 4.5+ with a recent build of the openCV framework:
http://www.github.com/foundry
See if you can get one of those running (they should not require any modifications), then try drag the openCV framework into your project.
You may have issues if you are running xcode4.3, as most of these were created using Xcode 4.5. But this one:
http://www.github.com/foundry/OpenCVSquaresSL
Has three targets. The SL target uses an openCV framework and build settings designed to run with XCode 4.2 under Snow Leopard, it will probably work if the others don't.
Alternatively - better - upgrade to current XCode (4.6)
Related
I've done this before, several years ago with Xcode 5 or 6. Now using Xcode 8 or 9, I seem to be missing someting.
No matter what I've done, when I try to build and link my project, I get the Linker message:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is not a duplicate question. It is not an architecture issue.
None of the other results I've found on S-O or google resolve this issue.
I'm obviously missing some build settings, but cannot figure out which one(s).
Between build attempts I've cleaned the build folder, and deleted DerivedData. Quit and restarted Xcode. Created a new set of projects with a new workspace and walked through the steps outlined below.
I'm writing in objective-C for this project if that matters (I don't think it does)
My question is what did I forget?
What I did --
Create a project for my framework and static library
a) create the project for a cocoa-touch framework - let's call it mySDK which creates mySDK.framework
b) Add a target for a cocoa-touch static library - let's call it SDK which creates libSDK.a
c) optionally build both targets -- they build fine
d) close the project
Create a project for my application - myApp - then close the project
Create a workspace - myWorkspace -- and open the workspace
Drag both project files from #1 mySDK and #2 myApp into the workspace
Build the framework and static library (both build and create the targets successfully)
Add the static library to myApp
a) Select myApp and go to build phases
b) Open Link Binary with Libraries
c) Drag from the library build products libSDK.a into the link binaries pane, set to "Required"
The library now appears in the Frameworks group-area in the myApp
7) Select the myApp project and go to build-settings
Add to Header Search Paths = "$(SRCROOT)/../mySDK/mySDK"
This resolves compile errors in finding the headers
Now I ask, why do I need to do anything else, shouldn't Xcode figure the rest out?
Various solutions or tutorials I've reviewed suggest adding:
Other Linking Flags = -ObjC
Library Search Paths = $(BUILT_PRODUCTS_DIR)
Library Search Paths = "$(SRCROOT)/../mySDK"
Changing Skip Install from YES to NO
Installation Build Product Location = $(BUILT_PRODUCTS_DIR)
I've tried all of these in different combinations.
Once I added the library to myApp I see that the Frameworks/libSDK.a file changes from red to black when I build the library so something in the workspace/project knows I built the library and it sees it.
So why when I try build myApp, do I still see the liner error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Nothing I have done seems to clear that error. I am pulling my hair out trying to find a solution.
I have also checked that it is building all the appropriate architectures, confirmed it using 'lipo -info'
Xcode obviously knows about the library, why isn't it linking?
My app also compiled with no problem but would hit an error while linking to the static library. My library was based on C++.
I had 2 problems to fix in my case:
The headers lacked proper extern "C" declarations for C functions in a C++ file.
One .cpp file did not #include its matching header so the extern "C" would be properly applied to the compiled version.
The linker had issues because the compiler used a mangled name for the function due to the mistakes. Later confirmed this by looking in the .a file with a text editor. I found my function with "_Z11" prefixed and "v" suffixed.
There was another clue: the error was reporting the missing function name with an underscore at the front.
Undefined symbols for architecture arm64:
"_myCFunction", referenced from:
SwiftModule.swiftFunction () -> () in MySwiftClass.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm trying to implement Facebook SDK into my project and I get the same issue
Facebook sdk is not a dylib error after update update Xcode 7?
Well, I have Bolts in my Frameworks Directory, also
In my Build Settings:
Frameworks Search Path: ~/Documents/Frameworks/FacebookSDKs-iOS-4.27.0
(That is correct for my path)
In my Briding-Header.h
#import <Bolts/Bolts.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
But, I'm still getting the same error, also, I just deleted the Derived data.
The error is:
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Some one has an idea about this error?
Well, the solution was weird, basically, I removed the Drag and Drop to my Framework group, and I added the FBSDKCoreKit, FBSDKLoginKit and Bolt using the general settings adding them in Linked Frameworks and Libraries
I also got this error and cleaning the project and building it again 4-5 times worked for me.
Cleaning - Command + Shift + K
Building - Command + B
Another solution is to delete these files in the project folder:enter image description here
pod install
instead of using the method described in FB official reference, I used pods to install them and I easily got rid of this problem
I have cloned the Google Authenticator source code from here. After opening the iOS project in Xcode, I realized that a lot of files are missing, thus resulting in hundreds of compilation errors when I try to build. Just a few of the missing files are:
GTMNSDictionary+URLArguments.h
GTMNSString+URLArguments.h
GTMLocalizedString.h
GTMRegex.h
Has anyone been able to build the iOS project for Google Authenticator?
UPDATE (June 29, 2015)
I was able to find the missing ZXing files here and the missing Google Toolbox for Mac files here. Then, I ran into a build error in OTPAuthURLEntryController.m at this line:
#property (nonatomic, retain) __attribute__((NSObject)) dispatch_queue_t queue;
I fixed it by changing the line to:
#property (nonatomic, retain) dispatch_queue_t queue;
Now I'm trying to fix the following "symbol(s) not found" issue:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Decoder", referenced from:
objc-class-ref in OTPAuthURLEntryController.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've searched all over SO but still haven't figured it out yet. Any help would be greatly appreciated!
I was able to find the missing ZXing files here and the missing Google Toolbox for Mac files here. I then added the appropriate missing files to the project. After this, I ran into a build error in OTPAuthURLEntryController.m at this line:
#property (nonatomic, retain) __attribute__((NSObject)) dispatch_queue_t queue;
I fixed it by changing the line to:
#property (nonatomic, retain) dispatch_queue_t queue;
After that, I ran into the following "symbol(s) not found" error message:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Decoder", referenced from:
objc-class-ref in OTPAuthURLEntryController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It turns out that the main project (OTPAuth) is linking to a library called libZXingWidget.a, which is missing (like many other things). I opened up the ZXingWidget project in the missing ZXing files and fixed the build errors by removing the custom flags that treated warnings as errors. Then, I built the static library and set the build target to iOS Device. This generated the libZXingWidget.a file I needed. I linked that file in the Build Phases of the main project (OTPAuth), and now Google Authenticator runs on the iPhone 6 simulator!
After updating to Cocoapods 0.36 beta 2 I experienced following problems in my Swift project:
I am not able to import googleplus-ios-sdk the old way, in my bridging header file:
#import <GooglePlus/GooglePlus.h> //--> FILE NOT FOUND
#import <GoogleOpenSource/GoogleOpenSource.h> //--> FILE NOT FOUND
Which seems to be ok, as for other pods (having the same issue when imported in bridging header) I can simply import proper frameworks in my swift source code files.
When trying to import Google frameworks in swift it works like expected:
import google_plus_ios_sdk //--> OK, no error here
...but it gives me an compilation error when trying to use any of Google's SDK class:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GPPURLHandler", referenced from:
__TMaCSo13GPPURLHandler 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 am able to integrate most of my old, Obj-C pods without an issue, but this one causing problems like described above. I have already cleaned up project, as well as removed all files stored in Xcode's DeliveredData directory but it didn't solve the problems.
Is there something I am doing wrong, or it's the problem inside the google-plus-ios-sdk pods? If so, are there any steps I could make to fix it?
Update it looks like FacebookSDK issue was fixed in version 3.22. I have updated description above, as problem is not connected with Facebook SDK anymore.
The error is..
Undefined symbols for architecture armv7s:
"ABCD_Initialize(ABCD_data_type*)", referenced from:
-[MyViewController doSomething] in MyViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I would like to list what all I've done
ABCD_Initialize is a function in header file of the static library i added.
Checked almost every related question.
Added all the files to target properly.
Linked the FAT file (.a file) in the build phases
lipo on FAT file says it is valid for armv6 armv7 and armv7s
Set Build Active Architecture Only to YES.
Added .h file related to the FAT file
restarted Xcode, Mac etc :)
A few things about my app
Created a workspace
Added a few other dependent .xcodeproj files to the workspace.
Added FAT file (of C++) and linked in build phases
set -ObjC flag in Other Linker Flags (to Load all members of static archive libraries)
Environment specs
Mountain Lion + Xcode 4.6 + iOS SDK 6.1
Let me know if you need more information. Any help is appreciated.
Thanks
J0k3r
My initial answer:
I'd say step 5 is incorrect.
If you're building a library, you want to build for all architectures, not just the "active architecture".
Set that to "NO" and see how it goes.
My second answer:
Also, make certain you've added "extern "C" in your library function declarations:
#ifdef __cplusplus
extern "C" {
#endif
ABCD_Initialize(ABCD_data_type*);
#ifdef __cplusplus
}
#endif
which help with demangling the symbols when they are linked against your app. Here's a related question with a decent explanation of what's going on.