Xcode error: referenced "_main": implicit input / start for main executable

I get the following error, which seems to come from something at the bottom to do with "_main".

Ld /Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Products/Debug-iphonesimulator/TownHall\ iPhone.app/TownHall\ iPhone normal i386 cd "/Users/jianglin/Desktop/TownHall iPhone" export IPHONEOS_DEPLOYMENT_TARGET=8.1 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Products/Debug-iphonesimulator -F/Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Products/Debug-iphonesimulator -filelist /Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Intermediates/TownHall\ iPhone.build/Debug-iphonesimulator/TownHall\ iPhone.build/Objects-normal/i386/TownHall\ iPhone.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-AFNetworking -lPods-Masonry -lPods-SDWebImage -framework CoreGraphics -framework Foundation -framework ImageIO -framework MobileCoreServices -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 -lPods -Xlinker -dependency_info -Xlinker /Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Intermediates/TownHall\ iPhone.build/Debug-iphonesimulator/TownHall\ iPhone.build/Objects-normal/i386/TownHall\ iPhone_dependency_info.dat -o /Users/jianglin/Library/Developer/Xcode/DerivedData/TownHall_iPhone-bdlgipvgaapgjhglhromfvcubbxz/Build/Products/Debug-iphonesimulator/TownHall\ iPhone.app/TownHall\ iPhone Undefined symbols for architecture i386: "_main", referenced from: implicit entry/start for main executable (maybe you meant: _OBJC_IVAR_$_PostTableViewCell._mainTextView, _OBJC_IVAR_$_ConfirmationViewController._mainLabel , _OBJC_IVAR_$_SignInViewController._mainLabel , _OBJC_IVAR_$_SignUpViewController._mainLabel ) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Any help would be greatly appreciated.

+7
ios xcode clang
source share
4 answers

I checked your project. The problem is simple, there is no main.m file in your project. I think you accidentally deleted this.

Add a new .m file to the project, name it main

And add the following code to it:

 #import <UIKit/UIKit.h> #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } 

There is also no info.plist in your project, so you need to add a new one.

+16
source share

add @UIApplicationMain to AppDelegate

+4
source share

My case was very similar, but a little different. The solution was partially triggered by @ Midhun-MP's answer above.

In my case, I added a tvOS version of my application. However, after adding a new target, main.m was not selected in the Target Membership section (thus warning about Undefined symbols for architecture x86_64: "_main" ). Checked that off and bam are GTG.

Thanks @ Midhun-MP.

main.m

+1
source share

If I'm right, you are using a simulator to run the application. To run the application on iOSSimulator, i386 architecture support is required. An error indicating that your binary layout structure does not support the i386 architecture. This may be the "SDWebImage" framework (I think). Try to run the application in a real device, not in a simulator, or try downloading a framework that has i386 entry points.

Another possibility is to verify that "AppDelegate" exists in the compiled source. Hope this helps you.

0
source share

All Articles