Very Basic Objective-C issue, I am sure

So I picked up a book on ojective-c namely Mr. Kochan's, and have been trying to work through the exercises and examples. I ran into my first problem that I haven't been able to solve myself. The error says that the object I tried to create "point" is being redeclared as a different type of symbol. Although I can swear I have the section from the book copied almost verbatim, I am sure I am doing something overtly wrong, but I still can't find it. Any suggestions would be greatly appreciated.
Thanks in advance!
Here is the code I am working with sans the header:
#import <stdio.h>
#import <objc/Object.h>
//--------------Interface Section----------
@interface Point: Object
int hcoord;
int vcoord;
-(void) print;
-(void) setHcoord: (int) x;
-(void) setVcoord: (int) y;
@end
//-------- Implementaion Section-------------
@implementation Point;
-(void) print
printf (" %i,%i", hcoord, vcoord);
-(void) setHcoord: (int) h
hcoord = h;
-(void) setVcoord: (int) v
vcoord = v;
@end
//--------- program section------------
int main (int argc, char *argv[])
Point *point1 = [[Point alloc] init];
[point1 setHcoord: 4];
[point1 setVcoord: 5];
printf ("The cartesian coordinates for point 1 are:");
[point1 print];
printf ("\n");
[point1 free];
return 0;
12" Powerbook   Mac OS X (10.4.7)  

OK. I think I see what's going on. Point is already declared in the Core Foundation, which is included in your project. If you're following the directions on page 10 of Kochan's book, they're kind of out of date.
I can get your program to build and run if I follow these steps:
1. Create a new project in Xcode. But instead of choosing a "Cocoa Application" like the book says, scroll down to the section that says "Command Line Utility". You want a "Foundation Tool".
2. In your "Source" folder in Xcode, you'll see two files, one with ".m" on the end, the other with "Prefix.pch" at the end. Open the ".m" file and replace everything with your code. Close and save the ".m" file.
3. Now, open the other file (the one ending with "_Prefix.pch" in your "Source" folder. There is a comment at the top, then three lines:
<pre class="command">#ifdef _OBJC_
#import <Foundation/Foundation.h>
#endif</pre>Comment out those three lines like so:
<pre class="command">//#ifdef _OBJC_
// #import <Foundation/Foundation.h>
//#endif</pre>Your project should compile and run. Alternatively, since Point is already defined, you can just change the name from Point something else.
Instead of step 3 above, just replace Point with something like MyPoint. Even just changing the "P" to a lower case "p" is enough to fix it.
charlie
P.S. -- If you haven't already visited, I suggest checking out Steve Kochan's page for that book. Pay special attention to the Errata section. There are some errors in the book and the corrections are there, so that's a good resource.

Similar Messages

  • Very basic Objective-C Question

    Okay, I am completely new to Objective-C so forgive me.
    I am trying to run a command when the MainView is initially loaded, so I figured I would need to override the constructor. I tried overriding init and initWithFrame, but it didn't work.
    How can I get a command to run (sendDate = [NSDate date];) when the UIView is initially loaded?
    Thanks a bunch.

    Let's take a step back for a second. Are you using Interface Builder (IB) with XViewController?
    Usually with a UIViewController there is no separate UIView class. At least not with the code I've written. A view controller creates its own view. If using IB then the view is created from the XIB file. There is no actual UIView class on the file system or in your project.
    So what ends up happening is the UIViewController loads the view and the view controller's 'viewDidLoad' method gets called. It is usually here that you finish off setting up the view. You access the view using 'self.view' inside the view controller code.
    But you seem to have an actual class named MainView that is a UIView. And it appears that class has an instance variable of 'sendDate'. Did you create this class by hand? If so then you must have explicit code for creating it. Where is this code?
    This is one of those details that I could explain is 5 seconds in person after seeing what you were doing. But online I can't, of course, see what you are really doing.

  • Entities not showing Contribution - very basic question

    Hi guys,
    Apologies for this very basic question - I'm very new to Hyperion, with just a weeks training! Anyway I'm building a basic model and have noticed that in the Value dimension my entities are not rolling up to the [Contribution Total]. This means that Entities do not roll up!!
    One suggested issue was that I needed a Sub Consolidate in the Rules, however I've set the attribute "ConsolidationRules" to be = to N. In the documentation this is defined as "N to use the default consolidation and eliminations."
    Wondering is there anything else that is needed to use default consolidations, or do I need to create some Rules??
    Thanks
    G

    Why do you think it is not rolling up? If your Consoldiation Rules are set to 'N' you do not need rules.
    Make sure your accounts are set to IsConsoldiate. Make sure you are viewing a 'Parent.Child' at Contribution Total.

  • Very basic doubt regarding transporting abap developments

    Hi All,
    It may be very basic doubt, But I need an answer.
    If we develop some objects in the development and transported them to quality and for some reason some errors occured and the for correction of the errors we created some more requests and ported them to Quality.
    the number of requests are say more than 15. and if we lost track of sequece of the requests to be ported to production.
    How can we overcome this problem?
    Can we create a new transport request by right clicking the package (of course all the objects are in only one package) , this will solve the purpose. I mean to say if we transport this single request to quality then to production, all the things will get transported?
    Please give your valuable inputs..
    Thanks and Regards
    KK

    Hi All,
    I really appreciate all your quick replys.
    My question is if we create a new request from the package in SE80, can we leave the old requests,
    That is if I transport a request say req 2 of domain for solving the dependency error of the previous request say req1 ( of data element ). and again transport req 1 after transporting req 2, this will solve the dependency problem. Like this if some dependency related issues are there and we lose track of sequence of request which needs to be transported, what could be the ideal solution?
    So I mean to ask that if I create a new request for the package in SE80, will all the developments will be included in the request or do we need to follow the sequence only?
    Thanks and regards
    KK

  • Getting Duplicate Object existing issue while deploying the BIAR file

    Hi All,
    We are trying to deploy BIAR File with XI R2 Command tool InstallEntSdkWrapper. But we are getting Duplicate Object exixting issue while deploying the BIAR file.
    Error Message:
    [report] [InstallEntSdkWrapper.main] Connecting to CMS plmdevapp31:6400 as administrator
       [report] [InstallEntSdkWrapper.CmsImportFile] Exception: An error occurred at the server :
       [report] Failed to commit objects to server : Duplicate object name in the same folder.
       [report]
       [report] [InstallEntSdkWrapper.main] BIAR File could not be imported
    If we are doing any promition with Import Wizard we have an option to "Overwrite object contents" option to overwite exixting objects. It will very helpful if any one suggest how we can achieve this through InstallEntSdkWrapper.
    Unfortunately there is no documentation availabe on InstallEntSdkWrapper.
    Cheers!

    That's a limitation with the XI Release 2 InstallEntSdkWrapper.jar tool.
    Sincerely,
    Ted Ueda

  • VERY basic - how to decide what type of architectu​re to use?

    Forgive me if I'm breaking any forum rules with this post - I'm very new to this.
    I'm trying to write a Labview program to perform a functional test on an electronic product.  The test is fairly sequential - plug in the unit, apply a certain voltage, step up the voltage until the unit turns on, then turn on an electronic load, measure the load voltage, then step up the input voltage again, etc.  The power supply and electronic load that I'm using both have Labview drivers. 
    I'm brand new to Labview, and I have no resources in my company to help me out.  I have taken the Core 1 and 2 training class.  The problem is, I'm not really sure how to start.  Would this be a producer/consumer architecture?  A QSM?  I've been scouring these forums the past couple of days, but most of the discussions are advanced.  I don't understand all the acronyms.  A lot of the replies here assume you have some knowledge of Labview, and I don't.  Part of the problem is that I don't even know enough to ask a specific question, and that's why this post is so vague.
    I'm a competent PLC/HMI programmer but don't have any experience in other languages.
    I also want to be able to use variables for my limits so that I can easily change the pass/fail limits.  (For instance, I want the voltage and current pass/fail limits to be configurable from a "maintenance" screen on the Labview interface, but I don't know how to create multiple screens or password protect them).

    I have stated my opinion reagarding the QSM* design pattern previously and will not repeat it again here aside from "I avoid them like the plague".
    Architecture questions are good question but hardly "very basic" although some architectures can be very basic.
    I would recomend a State Machine that uses Action Engines to control your widgets.
    in this thread AND this thread I wrote extensively and included design documents for apps I developed. I invite you to look those over and start developing your own design that meets your needs.
    Ben
    * It is imposible to fully document all of the possible transitions of a QSM and since my application all are fully documented, the QSM is not an option. A Queued Message Handler on the other hand is different.
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Very Basic Functions Question

    Hi,
    apologies for this being a very basic question, but I rarely
    use Flash. About once a year, however, I am called upon to do some
    sort of (usually very simple) Flash-based project for the students
    I assist. This time it's a simple random slideshow.
    The setup is this:
    * I have a movieClip called 'slides_MC' containing all the
    slide photos, on consecutive frames.
    * This movieClip is placed inside another movieclip named
    slideshowRand_MC.
    This is given an instance name of topslide_mc, and faded up
    and down with alpha keyframes.
    The idea is that, when the slides mc is faded right down,
    some Actionscript causes the slides movie to jump to, and stop
    playing on a random frame, so random slides are faded up, then down
    again, then swapped.
    I need to apply some actionscript to particular keyframes so
    that the swap is performed at the correct time.
    This is my attempt at a reusable function to do the swapping.
    It's placed in a keyframe on the root timeline:
    // Go to and stop at random frame in slides movieclip
    function goRandom(mc) {
    // Number of slides in slides movieclip
    var slides = 22;
    // Random number between 1 and number of frames in slides
    movieclip
    var randFrame = Math.ceil(Math.random() * slides);
    mc.goToAndStop("slide_" & randFrame);
    This function is called from keyframes in slideshowRand_MC:
    _root.goRandom(this.slideshow_rand_mc.topslide_mc);
    I know this is really basic stuff, but can anyone tell me why
    this isn't working.
    I've tried adding a breakpoint in the goRandom function, but
    it doesn't look like it ever gets called.
    Any assistance very gratefully accepted.
    Alex

    Hi Bob, thanks for getting back to me.
    quote:
    Originally posted by:
    Bob Pierce
    "_root.goRandom(this.slideshow_rand_mc.topslide_mc);"
    There's a typo in that line - if it's in your code, it won't
    work!
    Ah, true. The typo actually happened when I was re-writing
    the code in post. The actual code in the movie is
    _root.goRandom(this.topslide_mc);
    This is attached to a keyframe of the container movie-clip
    containing the slides MC.
    I've put the fla file on our server.
    slideshow_random.fla.zip
    If you, or someone else could download it and help me find
    out what I'm doing wrong, I'd be ever-so grateful. I'm sure it's
    something really obvious. Without being very familiar with Flash
    and Actionscript, it's hard to explain things, and much easier to
    show you the actual Flash file.
    The 2 functions are on a keyframe on frame 1 of the root
    timeline. The 'goRandom' function is supposed to be called from a
    keyframe in 'slideshowRand_MC'. I envisaged calling the random
    pause function from another keyframe in the same movieclip.
    Thanks again,
    Alex

  • One very basic question about inheritance

    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????

    SumitThokal wrote:
    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????What did you find out when you looked on Google?
    One example of inheritance comes in the form of a vehicle. Each vehicle has similarities however they differ in their own retrospect. A car is not a bus, a bus is not a truck, and a truck is not a motorbike. If you can define the similarities between these vehicles then you have a class in which you can extend into either of the previous mentioned vehicles. Resulting in a reusable class, dramatically reduces the size of code, creates a single point of definition, increases maintainability, you name it.
    In short there are thousands of benefits from using inheritance, listing the benefits could take a while. A quick Google search should give you a few hundred k if not million links to read.
    Mel

  • Need very basic tutorial for actionscript3 and Flash Builder?

    I'm VERY new to coding, only 17 wishing to persure computer science when i'm older.
    My issue is on adobe CC website all the tutorials require intermediate experience and I have none, however, i'm very passionate and think i will thrive with this new hobby.
    Anyone know any tutorials on where you start with very basic basics in these applications?
    Thanks.

    Ask in the forums for those programs... the people who use the programs will know more than here
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll

  • If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question

    If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question. Trying to hold out as long as I can, but purchasing an iPhone for Christmas and new iMac next year when warrently expires.

    Thank U very much for the quick reply, I wanted to upgrade this weekend, but still on the fence. I can live with the software that is not compatible, they are on another compuetr, just didn't want the obvious stuff to stop working.

  • Can someone help me with a very basic guide to animated gif with elements 11?

    Hi
    I bought Adobe elements 11 and have been trying to do a very basic animated gif with it.I came acroos some instructions about layering,etc but still cannot get it to work. All I want to do is add two of my school photos together so that one suddenly vanishes and the one appears.I am planning to put this on my blog.
    The animation I want is the day time picture of teh school magically vanish and the night time picture appear.Can it be done with elements11(I wouldn't mind if someone can even do it for me so that I could deconstruct it later!).I have attached the two photos.Please remember ,my knowledge of phtoshop is abysmal and very very basic.My apologies for that.hence I might be need to be told like a 10-year old!
    Please help as I need this fast! Karen.

    It’s not possible to fade between gif images but you could sandwich two layers with a black fill layer between them as I have done in this example.
    Then use the menu:
    File >> Save For Web
    Choose gif as the file type, select animate, and set your timing in seconds with continuous loop if required.
    Then Save.
    PS the images are different sizes so I had to re-size the daylight image to make it the same as the night image.
    Click to view

  • Possibly a very basic question but I have set up a spread sheet in Numbers and have viewed help videos but I can't get it to give me sums for the columns I highlight.  Keeps coming up with the figure zero.  I have version 09 2.3(554). Can anyone help

    Possibly a very basic question but I am going nowhere without a solution.  I have set up a spreadsheet in Numbers but it won't give me sums for chosen columns. I  have viewed the run through videos and used the formula but nothing happens apart from giving a figure of zero or a red arrow.  The sum icon in the bottom left hand section of the window does not highlight or show any total as I understand from the video that you can drag whatever total is here onto the relevent position on your spreadsheet.  I have Numbers 09 version 2.3 (554). Can anyone advise. Thanks.

    Hi Sohojools,
    To sum a column, use a formula such as this one in Cell A6
    Type this in a cell below your data:
    =SUM(A2:A4) or whatever range of cells you want to sum. The easy way is to type:
    =SUM(
    and then drag or shift-click to select the range of cells. Close the formula with a final bracket ")".
    The sum icon in the bottom left hand section of the window does not highlight or show any total
    To see the sum (and other simple statistics) in the bottom left, select a range of cells. That tells Numbers which cells you are refering to.
    The videos are good, but the Numbers'09 User guide, and the Formulas and Functions User Guide are better. Download them from the Help Menu in Numbers.
    Regards,
    Ian.

  • Very Basic Question i think ?

    Hi im very new to flash but am looking to learn some more
    about it i have tried to use the pre-built components in flash and
    was just wondering where or how you can retrieve the values from
    the checked boxes
    i know how to do for 1 checkbox by using
    if ( instancename.value = true){
    trace("Box was ticked");
    but what i am looking to do is run through a series of 5
    checkboxes and retrieve all the labels at first i can probably work
    out the checking if they are ticked but all i get traced is
    undefined which i guess means no value.
    This is the code i used to try to retrieve all the labels of
    every checkbox on press of a button
    on(release)
    trace("Clicked");
    var i = 1;
    while (i < 5){
    trace("While Running");
    i++;
    trace(CheckBox
    .Label);
    trace(i);
    It would be most appreciated if anyone could point me in the
    right direction for very basic tutorials on flash components as i
    could only find the macromedia livedocs which i didnt find a lot of
    help as its all technical speak which i am not familiar with
    yet....
    Thanks Pinky

    Many Thanks!!!!!
    This was the output i had to change the for to say i < 6
    to do the final checkbox but it is exactly whati wanted to do
    without having to use multiple if,s :D
    Many Thanks now just gotta try to work my head round
    comboboxes which i would have to start a new thread :D lol

  • Help with Project Management setup from very basics...

    hi all!
    i am new to e-business suite and now i have installed vision demo database successfully on a Quad Core with 320 GB hard and 4 GB ram...now i need help to setup Project Management (PM) module for a hypothetical construction company with the required functionalities (just limited functionalities and Not complete functionalities as in EBS).i need help in setting up Project Management module from the very basics...so can you help me out in this...thanks in anticipation

    Hi,
    Please post only once (do not post same thread across multiple forums).
    help with Financials setup from very basics...
    Re: help with Financials setup from very basics...
    Regards,
    Hussein

  • VERY Basic Questions about Oracle eBusiness - what "languages" are used?

    Please forgive the very basic nature of this post- (I have been in systems (IT) for over 20 years, so I do have lots of systems experience, but no exposure to this particular software.)
    So here are the basic questions - I assume that much of the data base logic is written in PL/SQL, but what other tools / languages are the applications written in?
    (Oracle Forms, Oracle Reports, Java, C, something else?)
    With over 20 years and experience with a number of other packages, I can learn a great deal about an application by 1. Looking at the DB structures (charts), 2. looking into DB code (Packages, triggers, procedure, functions) and 3. Seeing the screen shots.
    None of my customers have had Oracle eBusiness - that have had home grown applications or other COTS/packages.
    can anyone suggest a place where an independent person can inexpensively get some exposure?
    My sincere thanks for any answers/suggestions. 

    Hi,
    Please refer to the following links for details about the different database releases and Oracle tools.
    Oracle Timeline
    http://www.oracle.com/timeline/index.html
    http://www.oracle.com/oramag/profit/07-may/p27anniv_timeline.pdf
    Oracle Corporation - Oracle FAQ
    http://www.orafaq.com/wiki/Oracle_Corporation
    Oracle E-Business Suite consists of Application/Database/Client tiers, you can find more details in [Oracle Applications Concepts|http://www.oracle.com/technology/documentation/applications.html] manual.
    Oracle Forms
    http://en.wikipedia.org/wiki/Oracle_Forms
    Regards,
    Hussein

Maybe you are looking for