MetaGuru
MetaGuru

Reputation: 43873

New to iOS dev: How do I know where to look to fix this "Undefined symbols for architecture i386" error and what does it mean?

I have no idea where to look to find where this error is, because I am having a hard time interpreting these error messages. I'm used to C# and the error messages are amazing apparently... anyways, how can I fix this and what does it even mean?

Ld /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator/MiniStories.app/MiniStories normal i386
cd /Users/Ryan/Desktop/MiniStories
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang 
-arch i386 -    isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer SDKs/iPhoneSimulator5.0.sdk
-L/Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator
-F/Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator
-filelist /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Intermediates/MiniStories.build/Debug-iphonesimulator/MiniStories.build/Objects-normal/i386/MiniStories.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker 
-no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -lsqlite3 
-framework QuartzCore -framework AVFoundation -framework UIKit 
-framework Foundation -framework CoreGraphics 
-o /Users/Ryan/Library/Developer/Xcode/DerivedData/MiniStories-aburzjgfwocruwabfufijwygorxl/Build/Products/Debug-iphonesimulator/MiniStories.app/MiniStories

Undefined symbols for architecture i386:
  "_main", referenced from:
  start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

Upvotes: 2

Views: 2331

Answers (2)

GOPI
GOPI

Reputation: 131

I had the same issue and I just figured it out and made it work. I am following Stanford IOS development tutorial and I was about to complete (a few final touches) assignment III, The application was working fine all along and once I got this error, I was convinced that I messed up something, I almost spend 3 hours trying to debug and finally realized something else is wrong, while I was not able to figure out the exact reason, I overcame it by creating an another project and just copied (not linking) the files from the project to this new one and it started working.

I think the situation I encountered was weird, one thing I can say is I did reboot my mac since I had it up and running (almost 1 month),in the middle I had couple of OS updates, so I am attributing this error to that :)

Upvotes: 2

Zaky German
Zaky German

Reputation: 14334

This error shows when you're trying to link against a precompiled library that is built in a different architecture than your target.

My guess is that you are trying to compile something for the simulator, but you're using some external library in your project (file with a .a extension) that was built for the device architecture. If the library was actually built for the device, it will probably compile for the device, but if you want to test stuff on the simulator, you'll have to either recompile the library and make it universal if possible, or use a separate build for the simulator if one is available.

Upvotes: 3

Related Questions