I can't for the life of me find a solution to this! I'm using Swift. All of a sudden I get this error:
Undefined symbols for architecture i386:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
It doesn't matter what simulator/device I try to run for, I still get it:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
What is this?! I've almost removed everything from my project. I.e. all frameworks and everything. It's still there.
Please help me
Have this in your AppDelegate.swift:
import UIKit
#UIApplicationMain
Another cause (not for you but for others searching for an answer) is that AppDelegate.swift is for some reason not included in the app target. I don't know why that would happen-- I assume it was user error on my part-- but without that you'll get this error, and the cause isn't obvious. Make sure the checkbox for the file is checked in the app target.
I had the same problem, but I just forgot to put #UIApplicationMain on the top of the AppDelegate.swift
My Issue was this:
"main.m" got removed the project.
My problem was the following. I had 2 AppDelegate files. The original one that I wanted to delete, and another one I wanted to add. I first added the new one to the project and then deleted the old one. Following this order created a linker error. It worked when I deleted the new one and added it again to the project. Cheers
I had this same error and found that main.m was included in the list of project files, but was not ticked in the Target Membership list.
Some of the classes and frameworks(like FB SDK) are not ticked like in the picture.
So, I manually ticked(only .m files and frameworks) in all classes and frameworks in the Project Navigator.
If this error come you have two problems:
you comment out (with //) the appleDelegate.swift, you should uncomment it
you miss the appleDelegate.swift in your project
To fix this issue in Xcode 12.3, add the #main attribute to AppDelegate.
Related
Hello I have a project that some one has developed. It has G+, FB integration. When I get the project and try to run it, it gives me this error. How I can solve this? Please help me.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CMMotionManager", referenced from:
objc-class-ref in GooglePlus(GPPSpamSignal.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks
Undefined symbols means usually that you are missing an import statement.
Looks like you are using
CMMotionManager is part of CoreMotion, so you might need to :
#import <CoreMotion/CoreMotion.h>
And verify that you have added CoreMotion to your project
As CMMotionManager is part of CoreMotion framework, simply include the framework in your build in Xcode in "target"'s Build Phases: "link with": add "+" "CoreMotion.framework"
I managed to invoke this unholy error by simply adding the .h and .m files to the project.
I fixed this by removing them, and then right-clicking on the project, clicking New File, and choosing a new iOS Cocoa Touch class.
After that, I copied the relevant code into the respective .h and .m files. Doing it this way properly links the files
CMMotionManager is part of CoreMotion.framework.
In Xcode 11.3, TARGETS > Frameworks, Libraries, and Embedded Content > click the add button '+', add CoreMotion.framework.
The picture is in the below.
It appears that you are using GooglePlus SDK and the SDK is not supporting arm64 architecture. You need an updated SDK that supports arm64 architecture. Make sure you have latest copy.
I'm working on Parse/Facebook login that keeps giving me the following error:
Undefined symbols for architecture x86_64:
"_FBSDKAccessTokenDidChangeNotification", referenced from:
There are over 60+ such errors, not sure why they are appearing since this code is working in a different project. I was copying over some code and this started happening, any advice?
Check if you have the import part copied to your new project as well, so does the dependencies.
When it said undefined symbols, it means the function _FBSDKAccessTokenDidChangeNotification can't be found while compiling, which usually means the correspond framework/SDK/library were not there.
While I'm not sure what caused this issue, the following solution cleared up the error messages:
Go to the main page for the app (on the navigation thing on the left click on your apps name or the top section) -> Build Settings and under Linker Flags, make sure there is nothing in your Other Linker Flags
I have an iOS project which includes the Parse library. It has been working fine.
Today, I needed to add the Google Conversion Tracking SDK to my project. The instructions for adding this SDK require that I change my project settings to include the -ObjC linker flag.
When I did this, I could no longer compile my project. The errors I receive are of the form "Undefined symbols for architecture x86_64", and in every case the source of the error is something in the Parse SDK. Here is one example of the 6 errors I'm getting:
Undefined symbols for architecture x86_64:
"_ACAccountTypeIdentifierTwitter", referenced from:
-[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
I've never had to use the -ObjC flag explicitly before. My understanding is that this flag tells the compiler to link every class that was compiled even if it isn't explicitly referenced in the source code. Other than producing a larger executable, I can't see how this would cause a problem.
Appreciate any solutions or ideas.
Thanks.
I recently had a similar issue (not with parse though).
Open PF_Twitter and see what frameworks are included in it's header and implementation files. Then go to your target's Build Phases and add those frameworks in "Link Binary With Libraries".
If this doesn't help, other alternatives are discussed under this stack overflow question--
Undefined symbols for architecture arm64 Parse
Thanks. Adding the Social framework fixed the problem for me.
After upgrading to Xcode 6 beta 7 (and now still with Xcode 6 GM) I am unable to link my Swift app. I receive errors such as:
Undefined symbols for architecture armv7:
"_swift_stdlib_compareNSStringDeterministicUnicodeCollation", referenced from:
...
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have seen the other SO posts that recommend deleting the Derived Data folder and/or using the Clean Build Folder option to get past this error, but that solution didn't help at all in my case. Nothing has changed about my code or the CocoaPods I'm using since Xcode 6 beta 5 which is the last time it worked.
Any ideas?
EDIT:
A full posting of the error log:
Undefined symbols for architecture arm64:
"_swift_stdlib_compareNSStringDeterministicUnicodeCollation", referenced from:
TFC12MyProject21BarcodeViewController13captureOutputfS0_FTGSQCSo15AVCaptureOutput_24didOutputMetadataObjectsGSQGSaPSs9AnyObject___14fromConnectionGSQCSo19AVCaptureConnection__T_ in BarcodeViewController.o
"__TFSs21_arrayConditionalCastU___FGSaQ__GSqGSaQ0_", referenced from:
TFC12MyProject27SessionsTableViewController17viewWillDisappearfS0_FSbT_ in SessionsTableViewController.o
"__TFSs15_arrayForceCastU___FGSaQ__GSaQ0", referenced from:
__TFC12MyProject7RestApi12tokenMappingfS0_FT_CSo15RKEntityMapping in RestApi.o
__TFC12MyProject28AttendeesTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in AttendeesTableViewController.o
__TFC12MyProject27SessionsTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in SessionsTableViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o
"__TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_", referenced from:
__TFC12MyProject7RestApi12resetRestKitfS0_FT_T_ in RestApi.o
__TFC12MyProject16BluetoothManager17_startAdvertisingfS0_FT_T_ in BluetoothManager.o
__TFC12MyProject19LoginViewController32registerForKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController35deregisterFromKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController16callProcessLoginfS0_FT_T_ in LoginViewController.o
__TFC12MyProject21CheckinViewController16enableBeaconModefS0_FT_T_ in CheckinViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's happening here has nothing to do with your Derived Data location.
When a swift application is built, it goes through several steps:
Write auxiliary files
Create product structure
Compile swift source for each architecture
Copy resource rules plist
Copy application bridging header
Link against swift runtime libraries for each architecture
Copy application swift module for each architecture
Create the application binary
Copy resources build phase
Copy the swift standard libraries into the application
Package it up
Sign it
Whew! That's a lot. Your build is failing when linking against the swift runtime libraries. They live in Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos inside the Xcode developer directory. Specifically, the library that is not being correctly linked is libswiftCore.dylib. If you use nm on that library, you can see it defines your first missing symbol:
quellish% nm /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib | grep compareNSStringDeterministicUnicodeCollation
00197c8c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation
000000000018352c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation
You can also use lipo to see what architectures are in the file:
quellish% xcrun lipo -info /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib
Architectures in the fat file: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib are: armv7 arm64
It contains armv7 and arm64. It's not the library architecture that's the problem.
Linking against the swift standard library is not working. It's possible that source control or migrating Xcode versions has caused your project file to drop part of the linking step, or it's simply not able to find the libraries it needs to link against. Xcode project files are complex and use a lot of references - it's possible that a merge, etc. caused a critical reference to be come dissociated from the linking step. Without a full build log and a look at your machine it may not be possible to tell.
This library, as you might guess, has nothing to do with the project's derived data location.
The best way to move forward would unfortunately be to recreate the project file. Comparing the build log of the broken project to a swift project that does build correctly may provide some insights, but it may also be a waste of time - something fixable may be the problem, but more likely not.
I would encourage you to file a bug and include the troublesome project file with it.
I have solved my issue by deleting all the data in the ~/Library/Developer/Xcode/DerivedData folder. I read about that in another thread, but ignored it thinking a clean included that process!
I have Updated on Yosemite, Xcode 6.1.
I have updated gem xcodeproj (0.19.4) and cocoapods (0.34.4).
I have resolve my conflict by :
Clearing the Library/Developer/Xcode/DerivedData folder
replace in Target -> Build Settings -> Linking -> Other Linker Flags : $(OTHER_LDFLAGS)
Check in Target -> Build Phases -> Copy Pods Resources : "${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh"
1) I face the same problem but just clear the applications from derived data from User/Library/Developer/Xcode/DerivedData and I am able to run the code.
2) In your case may be, it will run by removing armv7 architecture from build settings. And make sure your compiler is Default Compiler in Build Settings.
Thanks I hope this helpful to you and everyone.
This seems to be caused (for most) by linking a third-party library that does not support the requested architecture.
I had somewhat similar problem (a linker error from Apple's framework). As it turned out, the problem was that I was missing the library LocalAuthentication.framework. I am wondering if maybe you need to delete the Foundation.framework from the Build Phase tab (in the Link Libraries section), and then re-add it? Maybe that will solve the problem?
'Upgraded' to xcode 6 and swift app wouldn't build for simulator yet would build fine on an iPad - Linker error, undefined symbols for i386 for the simulator.
Clearing the Library/Developer/Xcode/DerivedData folder worked for me.
There appears to be a bug in Xcode 6.0.1 that is causing the linker to drop dependencies in existing project files. I have had this same problem across several different projects, new and old, since the 6.0.1 update.
The easy 'fix' is to just trash your entire 'Derrived Data' and all build files (i.e. manually clean the project) and then rebuild after a fresh Xcode restart. Magically, the linker now finds all the missing architectures/symbols.
NOTE: I have had several incompatible v-table crashes caused by this same bug. The C++ linker appears to be generating incomplete linkages, causing absurd errors where there are no real errors to be found. Again, just rebuild from a clean state and .. ta da.. save yourself a LOT of headache and wasted time tracking down a non-issue.
I solved this issue after trying all that was suggested here with no luck.
Like someone said earlier, it's a SourceControl issue.
One of my project files (the one referenced in the error message) was missing from the project browser. However, XCode still had a reference to it (I was going to the class definition when I was selecting "jump to definition" from Xcode GUI).
As a matter of fact, the project.pbxproj was not listing it. This was probably a Git Issue. In any event, I just recreated the file in the same directory it has been recreated and voila.
I am a filly when it comes to iOS Objective C, though I have been coding in several other languages for many years. So I am stabbing around in the dark most of the time with Objective C.
I started having this error, "Undefined symbols for architecture armv7", directly after declaring some "global" variables in my .h file like so:
extern NSString *globalNotes;
extern NSString *globalUserCountry;
I was then referring to these variables from the .m file like so:
globalNotes= #"Error (Marker 1010)";
globalUserCountry= #"No result";
THE FIX - To correct this, I changed them to object properties like so:
#property(nonatomic, strong, readwrite) NSString *globalNotes;
#property(nonatomic, strong, readwrite) NSString *globalUserCountry;
And referred to them like so:
self.globalNotes= #"Error (Marker 1010)";
self.globalUserCountry= #"No result";
That seemed to fix my problem.
I'm trying to implement a "pull to refresh" functionality to my table views.
I found a couple of classes that should do the trick (iStopped's PullToRefreshView & Leah's PullToRefresh)
Both classes throws me an error about undefined symbols for i386...
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_PullToRefreshView", referenced from:
objc-class-ref in FeaturedTableView.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
Thing is.. I linked against QuartzCore.framework in the Build Phases..
And in the Build Settings, under "architectures" (and "valid architectures"), I see both "armv6" & "armv7".
I searched around the web for that error regarding PullToRefresh, and all I could find is that the framework is missing... but it isn't (I even removed it and re-added it).
I also came across this tutorial, which says I need to Refactor (edit -> refactor) my project (convert to Objective-C ARC), but I can't do that because when I choose my target, I get LOTS of errors (especially from the Facebook SDK).
Isn't there a simple way to add a pull to refresh functionality? :)
Any help would be much appreciated!
Thanks!
Ok, I've found the actual issue:
I have several Targets that share the most of the project's code.
When I was importing the PullToRefresh class, I de-selected all of the Targets, because I noticed that all the other shared files in the project had all the targets in their properties de-selected...
When I re-imported the class and selected all the Targets, everything works fine... I'm now actually using the EGOTableViewPullRefresh and it's working great.
So I guess de-selecting all targets doesn't mean that it's completely shared across all targets :) I wonder why all my view controllers and all don't have any targets checked and they are available to all targets...
But the issue has been resolved (^_^)
Thank you, #jrtc27 , for making me check the import procedure again.
(Without seeing your code) You need to import the PullToRefreshView class.
#import "PullToRefreshView.h"
Or you need to make sure that your table controller (which seems to be FeaturedTableView) is a PullRefreshTableViewController.
Example
#interface FeaturedTableView : PullRefreshTableViewController
{
/* your objects here */
}
#end