Create project & get 2 Mach-o errors before typing anything


#1

Help please , someone

yesterdays projects run just fine, Ive made no changes that i am aware of to an installation on my computer

just creating HypnoTime and immediately got 2 errors - i haven’t even typed anything just created the initial file

I’ve created the project 3 times now with same result - immediate red error warning - i did go thru as far as the first “now build and run the application” and obviously it failed to compile

any suggestions out there would be great

cheers

simon

[quote]
Ld /Users/SimonG/Library/Developer/Xcode/DerivedData/HypnoTime-dqgjrznfdhdnqlbjozronlkzyoia/Build/Products/Debug-iphonesimulator/HypnoTime.app/HypnoTime normal i386
cd "/Users/SimonG/Developer/BNR IOS Exercises/HypnoTime"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv 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/iPhoneSimulator5.1.sdk -L/Users/SimonG/Library/Developer/Xcode/DerivedData/HypnoTime-dqgjrznfdhdnqlbjozronlkzyoia/Build/Products/Debug-iphonesimulator -F/Users/SimonG/Library/Developer/Xcode/DerivedData/HypnoTime-dqgjrznfdhdnqlbjozronlkzyoia/Build/Products/Debug-iphonesimulator -filelist /Users/SimonG/Library/Developer/Xcode/DerivedData/HypnoTime-dqgjrznfdhdnqlbjozronlkzyoia/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/Objects-normal/i386/HypnoTime.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/SimonG/Library/Developer/Xcode/DerivedData/HypnoTime-dqgjrznfdhdnqlbjozronlkzyoia/Build/Products/Debug-iphonesimulator/HypnoTime.app/HypnoTime

Undefined symbols for architecture i386:
"OBJC_CLASS_HypnosisView", referenced from: objc-class-ref in HypnosisViewController.o (maybe you meant: _OBJC_CLASS__HypnosisViewController)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)[/quote]

then below that

"OBJC_CLASS_HypnosisView", referenced from: Objc-class-ref in HypnosisViewController.o (maybe you meant: _OBJC_CLASS__HypnosisViewController)
Symbol(s) not found for architecture i386
Linker command failed with exit code 1 (use -v to see invocation)

I have no idea whats going on here - this has thrown me completely - i did


#2

I believe I had similar problems at one point, and think it has something to do with dragging files from one project to another (which is what we do in this chapter).

When you drag the HypnosisView files over to your HypnotTime project, I suggest you click on “Add To Target” in the window that appears (as well as "Copy items into destination group’s folder ").

Hope this works for you,
Nick
http://myfirstiphoneapp.co.uk


#3

it was a really strange thing

because i wanted to push on i went over to my girlfriends mac book air and created a new account for me to code in and downloaded xcode and created the problem using dropbox as my file location

it of course didnt throw up the error

back on my macbook pro i i fired up xcode and pointed it to that file in my dropbox account and it didnt show the error

really funky

the file i had created local did

anyway i moved on with that project

I’m also watching the stanford videos at the moment and this morning i decided type in the happiness demo

i created a single view application and immediately there is an red error warning again - a different type this time - i forget what it was - something to do with using UIView - again this is an error thrown up immediately after creating a new project from one of the templates -without me adding anything

i noticed that when my ipad is plugged in it would select that as the device to be targeted so i changed it to be iPhone 5.1 simulator but the error was still there

so i went to The Organiser and to devices and told it to ignore my ipad and the error went away

I havent paid my 99$ yet so im wondering as i am not allow to run code directly on the ipad if this is somehow causing these errors

any thoughts out there ?


#4

I had a similar problem, where I was getting the linking errors when I tried to build and run early on in the project, immediately after adding the HypnosisView files. I finally figured out that when I found the files using finder, I inadvertantly found the ones that I had downloaded from bignerdranch. When I deleted them from the project, and replaced them with the ones I had created from the previous chapter, everything worked properly. Woo Hoo!


#5

i have a new macbook air. I was likewise doing the second part of the hypnosis app in chapter 22. and I am getting the same mach-O error2. it says something about “ld: symbol(s) not found for architecture armv7” which makes me wonder if there is some hardware issue going on. it only is invoked by the code:

    boxLayer = [[CALayer alloc] init];

#6

I am having the same issues now in Chapter 7, I am following the directions precisely. HELP! I can’t find anything helpful for solving this problem.


#7

just fixed my problem. in my case i had forgotten to click “add to targets” for hypnotime when I dragged in view


#8

If all else fails, just create the file in the HypnoTime project, then just copy the code from the hypnosisview and paste it in - Xcode seems to get a bit funny sometimes when dragging source files from other projects.


#9

Wow xcode is really aggravating when it does stuff like this. Glad I have forums to look it up on!


#10

Wow! - I’ve been through the slime on this one… I’ve had Linker errors EVERYWHERE… I finally deleted ALL my Compile sources under the Build Phases menu then put them all back. I found that my TimeViewController files were shown in the project, but they weren’t checked as “Target Membership” in the File Inspector (and of course it wouldn’t just let me check the box!)

It runs and works, but I get a bunch of warnings like the below… any ideas?
-Dan

Warning: no rule to process file ‘$(PROJECT_DIR)/TimeViewController.h’ of type sourcecode.c.h for architecture i386

Warning: no rule to process file ‘$(PROJECT_DIR)/HypnoTime/…/HypnosisView.h’ of type sourcecode.c.h for architecture i386

Warning: no rule to process file ‘$(PROJECT_DIR)/HypnoTime/…/HypnosisViewController.h’ of type sourcecode.c.h for architecture i386

Warning: no rule to process file ‘$(PROJECT_DIR)/HypnoTime/HypnoAppDelegate.h’ of type sourcecode.c.h for architecture i386

CompileC /Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/Objects-normal/i386/TimeViewController-C161F33EB7DA9359.o TimeViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Family Data/Dropbox/Dev/BNR Guide/HypnoTime"
setenv LANG en_US.US-ASCII
setenv 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:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin”
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-sign-compare -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -fexceptions -fasm-blocks -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.6 -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch “-DIBOutlet=attribute((iboutlet))” “-DIBOutletCollection(ClassName)=attribute((iboutletcollection(ClassName)))” “-DIBAction=void)attribute((ibaction)” -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -I/Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/HypnoTime.hmap -I/Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/DerivedSources/i386 -I/Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/DerivedSources -F/Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Products/Debug-iphonesimulator -include /Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/PrecompiledHeaders/HypnoTime-Prefix-clbnzeimgymvmpfnjvbpmstniado/HypnoTime-Prefix.pch -MMD -MT dependencies -MF /Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/Objects-normal/i386/TimeViewController-C161F33EB7DA9359.d --serialize-diagnostics /Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/Objects-normal/i386/TimeViewController-C161F33EB7DA9359.dia -c “/Family Data/Dropbox/Dev/BNR Guide/HypnoTime/TimeViewController.m” -o /Users/dan/Library/Developer/Xcode/DerivedData/HypnoTime-afhuaxbgpezsnoamjwacuvbiqblj/Build/Intermediates/HypnoTime.build/Debug-iphonesimulator/HypnoTime.build/Objects-normal/i386/TimeViewController-C161F33EB7DA9359.o

/Family Data/Dropbox/Dev/BNR Guide/HypnoTime/TimeViewController.m:15:13: warning: unused variable ‘now’ [-Wunused-variable]
NSDate *now = [NSDate date];
^
1 warning generated.


#11

I too ran into this issue. It seems I must have forgotten to tick off the “Add to targets” check box when dragging and dropping the HypnosisView files to the project.
Anyway, the solution is rather simple: Go to the “Build Phases” section of the HypnoTime target (you should see it when the Project Navigator is active) a@nd add the HypnosisView.m file to the “Compile Sources” list.
@DXZDB1 - If you also add the HypnosisView.h file, you will get the “Warning: no rule to process file” warning. This is because .h files should not be part of the “Compile Sources” list (only .m files).