hillegass book problem

Discussion in 'Mac Programming' started by jamesapp, Aug 12, 2008.

  1. jamesapp macrumors 6502a

    Joined:
    Mar 7, 2008
    #1
    working on a program from Cocoa Programming For Mac OS X Third Edition
    by Aaron Hillegass. i am on, i believe the third program from the book. One thing i find confusing is that the second program, I think it is called lottery, created an executable that prints numbers at certain indexes:
    Code:
    The number at index 0 is 0
    The number at index 1 is 3 
    ... etc.
    
    I have the files for the book in my Home directory in a folder called Development.
    In the Development folder i have two folders, guiprograms and a folder called toolprograms. The first lottery program i put in the toolprograms folder. and i now have an executable file within a folder called lottery which is in the toolprograms folder. In the book it talks about: "In the toolbar, you will see a pop-up for the Active Build Configuration. There are two choices: Debug and Release. While working on your application, you will always want to be in Debug. ..."
    the book goes on to say that if you want your program to be universal use a Release Build. I built and ran the program before i could find the debug in the toolbar that the book was talking about. So i had two executables, one in a release folder and one in a debug folder. When i started working on the third program, when i went to build and run the program i got an error message:
    my x-code window says, symbol(s) not found. And it seems like the second program lottery's debug executable is gone. Some questions i have are:
    does my executable have a file extension?
    does the author want the second lottery program to be an extension of the first program? like in the book we just edited lottery.m adding some to the file and deleting some from the file.
    If i alter a file in x-code is the executable stay the same?
    One thing i did was go into terminal and compile the program from the command line and it compiled. What am i doing wrong? Any help would be appreciated.
    one thing i thought about doing was throw out all the files, and rewrite them.
    I am a little confused on the directory structure, like in the book they show a screenshot of typing the name of a file called LotteryEntry.m
    under location they have ~/Documents/Projects/Cocoa/lottery
    is the last entry in the path a name of a file or a directory?
    again any help would be appreciated.
    question is there a way in x-code to see where this error is
    or do to the nature of the error is this not possible in this example.
    There is other stuff written in the error from x-code.
     
  2. tedsmith3rd macrumors member

    Joined:
    Aug 30, 2006
    Location:
    US
    #2
    The executable won't, but your application bundle will have ".app"

    If I remember correctly, you're making a change to the existing program to improve it. So you're updating the code, not basing a new program on the old one.

    I don't understand the situation you are asking about. You changed a source file, hit "Build & Go," saved your changes, and the application didn't change?

    Might be a good idea if you can't get it sorted out. Generally, when you create a cocoa application project in XCode you have something like this:
    YourProjectName/build/Debug - The compiled app goes here when you are using the debug build configuration
    YourProjectName/build/Release - The compiled app goes here when you are using this release build configuration
    YourProjectName/build/YourProjectName.build/ - Generally you can ignore everything in here
    YourProjectName/English.lproj
    YourProjectName/Info.plist
    YourProjectName/main.m (and other source files)
    YourProjectName/YourProjectName.xcodeproj

    A directory. Your project folder is called "lottery" and it is inside you home folder, inside the Documents folder, inside the Projects folder, inside the Cocoa folder.

    For build errors, in XCode open the "Build" menu and select "Build Results." For run errors, open the "Run" menu and select "Console"
     
  3. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #3
    i opened terminal and compiled the program from the command line. and it compiled without any errors. but in xcode i was getting an error like symbols not found. One of my question is when working on a project, if you change it, the executable that you had is deleted, and a new executable is created, unless you choose a new project, is that correct?
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    It is not deleted, but it is out of date so will need to be recompiled when you next run the application from within Xcode.
     
  5. LoveMyMac2004 macrumors newbie

    Joined:
    Aug 18, 2008
    Location:
    Myrtle Beach, SC
    #5
    Hi all,

    I am now going through the same book and I have had a few problems as well. On the third program I had a problem with warnings saying that the object did not exist or object may not respond to message x. I cured that by doing a "Clean All" then build and run the app. That worked well (except for the undocumented part about using objective-c 2.0 features which is only available on 10.5 and I am using 10.4). If you still have problems see my post in:
    Mac Forums > Apple Software > Mac Programming > Using objects in a for loop gives an error at compile

    Hope this helps someone else as it did myself.

    -Don
     

Share This Page