This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to get rid of the warning “file was built for unsupported file format” when linking with a static library?
I write #import <AVFoundation/AVFoundation.h> in my code but when i compile it gives the following error: 'AVFoundation/AVAsset.h' file not found
Also I got following warning:
ld: warning: ignoring file /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks//AVFoundation.framework/AVFoundation, file was built for unsupported file format which is not the architecture being linked (armv7)
Kindly help
You have to add the AVFoundation framework to your target.
In Xcode select your Project, then select your target, click on "Build Phases" and expand "Link Binary with Libraries". Then click on the "+" and search for AVFoundation, add it and you should be good to go.
Scratch my previous answer, I found a more likely solution.
I believe that when you added the framework to your project you copied it into your project instead of simply linking it to the project. You should remove the framework from the project, by deleting ONLY if necessary. Then add the framework again.
If you are adding it by dragging and dropping from Finder, be sure to uncheck the "copy" checkbox when coping to Xcode.
Related
I using CoreML with Swift 4.0 on Xcode 9 Beta.
I downloaded Inception v3.mlmodel files from WWDC
I get the errors Use of unresolved identifier 'InceptionV3' and Use of undeclared type 'InceptionV3'
And i download some sample projects and also getting same problem with that downloaded projects.
Now what can i do ?
Thanks
InceptionV3 is auto generated when you drag and drop the .mlmodel file to your project. Try remove the reference to that file and drag and drop again. Also ensure the target in Target Membership is selected (select the .mlmodel and look at the right panel).
I'm creating an iphone app using xcode 4.2, and trying to use the AVFoundation Framework to play some radio stream.
When i import it to the project's frameworks and the build, i get the following warning:
ld: warning: ignoring file /Users/xanthos/Documents/tabbartest/AVFoundation.framework/AVFoundation, file was built for unsupported file format which is not the architecture being linked (i386)
and of course when using anything of the framework (eg AVAudioSession) i get errors like:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AVAudioSession", referenced from:
objc-class-ref in RadioStreamer.o
I've read so many posts about how to compile AVFoundation Library, by i really don't get it, i'm really inexperienced in all these. I can see there's something with the linking of the library, but not completely understand it.
Any clues please?
Thank you in advance.
It looks like you have you copied AVFoundation.framework from somewhere to your project directory. That's wrong. You just need to add it to the "Link Binary With Libraries" build phase of your project:
In Xcode, select the project in the navigator on the left.
Select the 'Build phases' tab in the main area in the middle.
Open up the 'Link Binary With Libraries' section.
Click the '+'.
Select `AVFoundation.framework. and click 'Add'.
I am trying to build an App using the GData static library libGDataTouchStaticLib.a
I have made all the appropriate linkings in my project settings and have copied GDataXMLNode.h and GDataXMLNode.m to my project.
I am receiving the error below. Can someone help me understand what this is?
ld: duplicate symbol _kGDataXMLXPathDefaultNamespacePrefix in
/Users/myUser/Library/Developer/Xcode/DerivedData/GData-edmqtrniowvhfjgfgngtlfxttvri/Build/Products/Debug-iphoneos/libGDataTouchStaticLib.a(GDataXMLNode.o) and
/Users/myUser/Library/Developer/Xcode/DerivedData/MyApp-grzimbvctfmwhmdluxbuxmskcvzy/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/GDataXMLNode.o for architecture armv7
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
You shouldn't have to copy in GDataXMLNode.h and GDataXMLNode.m to your project. I believe the reason you are getting the duplicate symbol error is because the libGDataTouchStaticLib.a library already contains the compiled GDataXMLNode.m class.
I am currently using the GData library in a project I am working on, and got it set up by using these instructions: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/, so this answer assumes that you have the same setup. However I have used a slightly different way of importing the headers that was suggested by one of the comments on the above blog.
In your Xcode project remove the GDataXMLNode.h and GDataXMLNode.m files, and make sure that the GData.xcodeproj project is linked into your project the same way as in the above blog, but do not drag the headers directory to your source tree. Add these arguments to the Debug and Release Header Search Paths of your current target instead:
/usr/include/libxml2
${BUILT_PRODUCTS_DIR}/Headers
You can find this under the Build Settings tab of your target. The second argument will import all the GData headers into your project if you have set up the GData.xcodeproj file correctly. Once you have done this you should be able to import the various GData classes including GDataXMLNode.h class wherever you need it by typing this at the top of the appropriate class:
#import "GDataXMLNode.h"
Much credit goes to Kelvin's blog for his great tutorial. Hope that helps!
I have included the class KMLParser.m of Apple's KML Viewer in my project.The problem that I have is that when I try to build the project i get two errors like these:
_CLLocationCoordinate2DMake,referenced from:
_strToCoords in KMLParser.o
_CLLocationCoordinate2DisValid, referenced from:
_strToCoords in KMLParser.m
I don't have any idea why this error occurs, because i have left the files KMLParser.m and KMLParser.h intact, I haven't made any change to them.When I build KML Viewer, everything is fine. Please,illuminate me.
I am also working on implementing KMLViewer in my project. Turns out that accidentally linking with the incorrect target will cause the same errors.
For XCode 4.x, under the list of Targets, it could be that there are multiple targets, such as MyApp and MyAppTests. Select the correct target (e.g., MyApp), then add the framework(s).
You need to add the Core Location framework to your project (an #import alone is not enough).
For Xcode 3.x, right-click on the project file and go to Add - Existing Frameworks.
For Xcode 4.x, see How to "add existing frameworks" in Xcode 4?.
The documentation states that "This project compiles to a static library which you can include, or you can just reference the source files directly."
Here's what I've done. I've downloaded it from GitHub and unzipped it. Here are the classes I can see.
Now which file among these is the 'static library' that I should import into my project?
Additionally, if I just want to reference the source files, should I just copy the .h/.m files in Classes into my project? I tried doing that but throws the following error when I try to build it:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CALayer", referenced from:
objc-class-ref in AQGridViewCell.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Can any one show me how to set this up?
You may try to add the QuartzCore framework to your target.
All you need to do is add the class files to your project. Use the AQGridView.xcodeproj just as a reference to see how it uses the classes. It is actually a very friendly to use library of classes.
Once you added the class files to your project, when you create a new viewController, just follow the setup. Make sure you use the delegates for it and if you want to modify the gridViewCells just extend the AQGridViewCell class.
Also, as #FoJjen mentions, make sure you add the QuartzCore.framework to your project
First, add the classes. Then attach the library QuartzCore from Build Phases->LinkBinary with Libraries.
That's all.
Wasted 1-2 hours myself so wanted to share it with others
I see two possible ways of achieving this (tested on Xcode 4.5)
First way - Proper referencing
Ensure no other Xcode instance is open. Drag the Xcode project file (from Finder) into your project (into Xcode explorer window).
Click on your project in the explorer window, go to Build Phases, under Link Binary with Libraries, add "libAQGridView.a" and QuartzCore.framework
You should be all set. Just remember to include the necessary header files when you use it
Second way - Copying classes
You can have a look at the samples. It's merely copying the source code into the project (as opposed to linking it as a static library)