Warning: (Insert object here) may not respond to '+alloc' ?

I'm just getting started with Objective C development, and the following example that I am working with results in the following error:
fraction.m:6: warning: ‘Fraction’ may not respond to ‘+alloc’
fraction.m:6: warning: (Messages without a matching method signature
fraction.m:6: warning: will be assumed to return ‘id’ and accept
fraction.m:6: warning: ‘...’ as arguments.)
fraction.m:6: warning: no ‘-init’ method found
fraction.m:8: warning: ‘Fraction’ may not respond to ‘-free’
I am running Snow Leopard, and I have downloaded the most recent XCode and iPhone dev libraries.
I would very much appreciate your input. Thank you.
==========
#import <stdio.h>
#import <objc/Object.h>
/* Interface */
@interface Fraction: Object
int numerator;
int denominator;
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(int) numerator;
-(int) denominator;
@end
/* Implementation */
@implementation Fraction;
-(void) print
printf ("%i,%i", numerator, denominator);
-(void) setNumerator: (int) n {
numerator = n;
-(void) setDenominator: (int) d {
denominator = d;
-(int) numerator {
return numerator;
-(int) denominator {
return denominator;
@end
int main (int argc, char *argv[])
Fraction* myFraction = [[Fraction alloc] init];
[myFraction free];
return 0;
}

tkambler wrote:
I've determined that this script compiles just fine on my iMac running 10.5.8. My other iMac, which I just installed Snow Leopard on, is the one that is giving me the errors. Any thoughts?
Fraction.m compiled and ran under Xcode without any problems on my OS X 10.5.5 system. I don't have a Snow Leopard system, so can't reproduce the errors you reported.
My first guess would be that the difference in your two systems is a difference in the included Object.h file. On my system the included file lives in /Developer/SDKs/MacOSX10.5.sdk/usr/include/objc. That @interface does indeed declare alloc, init, free, etc.
From the compiler warnings you posted (which don't include "Can't find Object.h"), I would assume that either the Object.h file at the above path has changed, or that the wrong Object.h file is being included. The latter needs to be ruled out because (at least on my system) there are several Object.h files intended for different purposes. So for example, if your Snow Leopard Xcode isn't searching in the same folders, or if the correct Object.h has been relocated, it's entirely possible the wrong file is being included during the build.
Determining which possibility applies in your case may require some familiarity with OS X and Xcode, and I don't know if +just getting started with Objective C+ means just that, or whether OS X and all of the developer tools are also new for you. If the code you posted is part of an isolated exercise and you won't be using Object.h much in the future (since it's not used in Cocoa), my advice would be to stay on the system that works until you're done with the current exercise.
If you have a requirement to program in Obj-C without using Cocoa for an extended period of time, I'm sure someone here can help you find out what happened to Object.h on your Snow Leopard system. Of course things will be a lot easier if that help comes from someone who already has Snow Leopard.
You can get started by looking at the Object.h file Xcode is including. You can do this by selecting Object.h in a text editor window, then selecting File->Open Quickly from the top menu (see Opening Files by Filename or Symbol Name in the Xcode Workspace Guide). Is your Active SDK set to 10.6? If your Snow Leopard Xcode has the option to set the Active SDK to 10.5, see which Object.h file gets included in that case.
Hope that helps!
\- Ray

Similar Messages

  • My first Objectice-C code: Warning "may not respond to +alloc"

    I just finished my first steps into Objective-C and was thwart by the following warning in my very first exercise example: "Bruch may not respond to +alloc "
    Any hints are appreciated. Many Thanks in advance.
    Juergen
    #import <stdio.h>
    #import <objc/Object.h>
    // ------- @interface Abschnitt ----------
    @interface Bruch: Object
    int zaehler;
    int nenner;
    - (void) ausdrucken;
    - (void) setzeZaehler: (int) z;
    - (void) setzeNenner: (int) n;
    @end
    // ---------------- @implementation Abschnitt ----------------
    @implementation Bruch;
    -(void) ausdrucken
    printf (" %i/%i ", zaehler, nenner);
    -(void) setzeZaehler: (int) z
    zaehler = z;
    -(void) setzeNenner: (int) n
    nenner = n;
    @end
    // ----Programm Abschnitt------
    int main (int argc, char *argv[])
    Bruch *meinBruch;
    // Bildung einer Instanz
    meinBruch = [Bruch alloc];
    meinBruch = [meinBruch init];
    // Setzen von Zähler und Nenner
    [meinBruch setzeZaehler: 1];
    [meinBruch setzeNenner: 2];
    // Anzeigen des Bruchs via printf
    printf ("Der Wert von meinBruch ist:");
    [meinBruch ausdrucken];
    printf ("\n");
    [meinBruch free];
    return 0;
    -------------------------------------------------------------------------------

    It would be best to start with the various templates that come with Xcode. There are some books that use low-level Objective-C include files instead of Cocoa include files. What's the point? The only Objective-C you are ever going to use is on a Mac or similar, so just use what Xcode gives you.

  • This page contains some SWF objects that may not work properly...

    Hello Guys
    I bought this menu made by f-source into my page:
    http://beta.asphalt-driveway-sealing.com/, it's working fine except I got this message each time I am opening my file with dreamweaver CS4: 'this page contains some SWF objects that may not work properly in the most recent versions of Internet Explorer. Dreamweaver cannot  convert them to the new SWF markups. Please delete each of them and insert again' and what I did but still got this message
    the developer told me that: "I previous versions of Dreamweaver you could disable the Active
    Content Converter http://f-source.com/before_insert/
    In CS4 there is no such option."
    Please let me know what can I do then.
    Many Thanks, T&T

    Hi
    CS4 uses a 'nested' type of object code to insert swf/flv files, which is more compliant than previous code. Obviously the f-source extension is not cs4 compliant if it is changing this, (the message indicates it is doing so) and is something you should pursue via there support department. However even though it is giving you this message it should still work on live pages.
    PZ
    www.pziecina.com

  • Annoying error 2:  ViewController may not respond to -enableBBI

    Developers,
    This is my second annoying error. The code works fine, but i get the following error message when i run the app "viewcontroller may not respond to -enableBBI".
    The code i am using is below and i have placed ///Error/// next to parts of the code that trigger the error. The part of the code that shows an error is used to enable a Bar Button item.
    Is there anything i can do to prevent this? or does it not really matter?
    Ray, i am hoping you will have a quick glance over this. The code is something you gave me in the past. Perhaps you have a solution?
    james
    -(IBAction)NextItem {
    int count = [flashCards count];
    if (counter < count - 1) {
    NSDictionary *nextItem = [self.flashCards objectAtIndex:++counter];
    Label1.text = [nextItem objectForKey:Question_KEY];
    [self enableBBI]; ////Error//////
    -(IBAction)PreviousItem {
    if (counter > 0) {
    NSDictionary *nextItem = [self.flashCards objectAtIndex:--counter];
    Label1.text = [nextItem objectForKey:Question_KEY];
    [self enableBBI]; ////Error//////
    - (void)enableBBI {
    int count = [flashCards count];
    next.enabled = counter < count - 1 ? YES : NO;
    prev.enabled = counter > 0 ? YES : NO;
    flip.enabled = count > 0 ? YES : NO;
    Message was edited by: james_coleman01

    See xnav's suggestion, then add the following at the end of the file and move enableBBI inside:
    @implementation YourViewControllerName (PrivateMethods)
    - (void)enableBBI
    @end
    Using categories in this way is just a trick to simulate private methods in Objective-C. That way, you can define your methods where you want in the file without having to put them into the header file for all the world to see.
    You can create new categories for any class, including Cocoa classes like NSString, etc.
    Message was edited by: etresoft

  • Business Object Designer  Server Not  Responding (SBO0001)

    Hello!  I receive this error after importing the universe in BO Designer and clicking on Universe Parameters.  
    Server Not  Responding (SBO0001)
    and when I click details it says:
    DBD: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
    I receive it when I test the database connection.  I am using Windows 7 and when I go into ODBC Administrative Tools and test it works fine. Any help would be greatly appreciated.
    Thanks,
    Jen

    Please install the BO Clients tools XI 3.1 Service Pack 3 Full version . Windows 7 is supported only for XI 3.1 SP3 and higher.
    You have to upgrade your BOBJ server also (Client and server should be at the same version).
    And please install the 32bit database drivers. BO is 32bit and altough it runs on 64bit OS ithout a problem, it can only use 32bit libraries/drivers.
    Regards,
    Stratos

  • Folder actions dispatcher not responding

    Keep getting warning that Folder actions dispatcher not responding- any ideas ?

    There's a post here which offers some advice about that error.
    http://discussions.apple.com/message.jspa?messageID=1533747#1533747

  • IP Address or sender did not respond messages

    I am on Tiger and my mother in law is on Leopard, both are Macbooks. She is the only person I cannot video chat with. The errors come up either Invalid IP address or that I (when calling her) did not respond. On her end it says that I cancelled the connection. I thought it was her router, etc, but today I was at my folks (Leopard Macbook) and rang her for a video chat and it worked fine?! I can video fine with others with Leopard and Tiger, it is only her that it doesn't seem to want to work...any would would be awesome!! Thanks

    Tell us about how she connects to the Internet ?
    If she is wireless and Ethernet she can get this Problem
    AS can having a Modem that routes and a router both doing DHCP
    As Can using Parallels to run Windows and sharing the Mac Ip
    4:00 PM Saturday; March 1, 2008

  • 'User did not respond' - Has something changed with ichat?

    This seems to be an issue for nearly everyone. I have been using ichat video succesfully for over a year now. For some reason, in the last month or so, the video has stopped working on all three of my macs (powerbook G4 Tit, new mbpro, and imac g5 at home)
    From my tibook (10.3.9)...I can sucessfully connect to the apple test video without problem. The person I am trying to videochat with can also connect to the same apple test video with no problem. However, we cannot chat with video OR audio with each other.
    I have done a bandwidth test, and I am on a 1.5 T1. I am behind a company NAT (cisco 1700 router, Novell server handling the nat/pat) He is in LA and has succesfully be chatting with people on the east coast, so I don't think he is the issue.
    Here is the log from the connection doctor:
    2006-05-16 09:33:45 -0700: REMOTE USER NAME HERE did not respond.
    Tried to send UDP SIP "invite" to the following IP addresses and ports:
    69.229.11.215:5060, 192.168.15.100:5060, 172.16.1.35:5060
    2006-05-16 09:40:51 -0700: REMOTE USER NAME HERE did not respond.
    Tried to send UDP SIP "invite" to the following IP addresses and ports:
    69.229.11.215:5060, 192.168.15.100:5060, 172.16.1.35:5060
    2006-05-16 09:47:26 -0700: REMOTE USER NAME HERE did not respond.
    Tried to send UDP SIP "invite" to the following IP addresses and ports:
    69.229.11.215:5060, 192.168.15.100:5060, 172.16.1.35:5060
    2006-05-16 09:53:33 -0700: REMOTE USER NAME HERE did not respond.
    Tried to send UDP SIP "invite" to the following IP addresses and ports:
    69.229.11.215:5060, 192.168.15.100:5060, 172.16.1.35:5060
    As it has been for nearly everyone else on the list, I am extremely frustrated. I have never had an issue using ichat, but now I can't get it to work from anywhere. I have been able to get everyone in my family to switch to imacs so they can chat with my kids....and now we can't get it to work at all.
    What am I missing? I find it hard to believe that this is so hard to use that so many people are not able to use it.
    Any help or new suggestions would be most appreciated.
    sqe

    I'm new to Macs and bought a MacBook Pro for myself and partner mostly for the iChat AV feature. Neadless to say, I'm frustrated beyond belief. I've spent over 25 hours trying to get it to work to no avail.
    Each of us can connect with the Apple test buddies with no problem. We can't connect with each other though, except for two times that it actually worked.
    I've troubleshooted everything I can think of. I've called my ISP (Verizon), Netgear (my wireless router), and just this morning I called Apple. I was at work so, I'll have to call them back when I get home but they don't seem to even know about the problem. Which is astonishing considering how many people are reporting this on the forum.
    I can connect to anyone while on my office wi-fi but only to the Apple test buddies when at home. That's why I called my ISP and Netgear. I took the router out of the picture and still had the same problem at home.
    It makes no sense that the Apple test buddies do work but not real people.

  • Authorization objects in RAR not updated

    Hi everyone,
    i'm facing an issue with RAR (GRC 5.3, SP10): i've just imported the authorization objects from SAP (SE38 -> /VIRSA/ZCC_DOWNLOAD_SAPOBJ -> saved in UTF8 format), but when i look the  function in the rule architet the authorization objects setting are not the same:
    Example: in SAP the transaction F-04 needs the auth obj  F_BKPF_BLA/BUK/KOA (i use transaction SU22 to check the auth obj) and the export file has the same settings:
    F-04     F_BKPF_BLA     ACTVT          
    F-04     F_BKPF_BLA     BRGRU          
    F-04     F_BKPF_BUK     ACTVT     01     
    F-04     F_BKPF_BUK     BUKRS     $BUKRS     
    F-04     F_BKPF_KOA     ACTVT          
    F-04     F_BKPF_KOA     KOART     $KOART     
    In RAR the transaction F-04 is in the function AP01, AR01, AR02, GL01. The transaction has different settings in every function: in AP01 there is only F_BKPF_KOA in status active, in AR01 there are F_BKPF_BUK and KOA in status active,...
    I re-generated all the rules, but the settings are still the same.
    I think the settings must be the same.
    Am i right?
    Thanks in advance!
    Luigi

    Luigi,
      The function has all the associated auth objects, right? All the auth objects/permissions may not be enabled in the function. As you are using standard SAP ruleset, SAP has determined that the combination of F-04 and associated enabled auth objects create violation when assigned with another set of tcodes and auth objects. You can always enable all the auth objects if that is what makes sense as per your business.
    Can you go through the RAR config guide to get an understanding on this?
    Regards,
    Alpesh

  • HT201412 my iPod touch is not responding , the screen in frozen & the screen is yellow .

    my iPod touch 4 is completely unresponsive , it will not do anything when i press any buttons & iTunes doesn't recognize its plugged in when its plugged into my computer . plz helpppppp !

    - Try here:
    iOS: Not responding or does not turn on
    - If not successful and the iPod is on to some degree like screen is white or has logo and you can't turn it off, let the battery fully drain. After charging for at least an hour try again
    - Make an appointment at the Genius Bar of an Apple store.

  • HT4060 My ipad2 is not responding for itunes

    hi there ... my ipad2 is not responding for itunes and it can  not switch off even with the sleep and on keys ... its been a year so no warranty on it. is there any way i can resolve the problem ?? pls.
    - Jagan Aiyappa.
    (Dublin)
    <Email Edited By Host>

    Hello jaganaiyappa,
    Thank you for providing the details of the issue you are experiencing with your iPad.
    I recommend following these steps for an issue like the one you described:
    If a single application is not responding or stops responding when it opens, you can force it to close.
    If the device is unresponsive or if certain controls aren't working as expected, restart your device.
    If the device remains unresponsive or does not turn on (or power on),reset your device.
    If there is no video or if the screen remains black, verify that the device has enough charge to turn on:
    If you are using an iPad, ensure that it's connected to the USB Power Adapter supplied with the device.
    Let charge for at least twenty minutes, then see if it starts normally.
    If there is no image on the screen, press the Sleep/Wake button to attempt to wake the device.
    If the screen displays a red battery icon, continue charging the device until the battery is fully charged.
    If the above steps do not resolve the issue, or the if the screen remains black or shows a persistent Apple logo, try restoring with iTunes:
    Connect the device to your computer and open iTunes.
    If the device appears in iTunes, select and click Restore on the Summary pane. Learn more about restoring iOS software.
    If the device doesn't appear in iTunes, try to force the device into recovery mode, and then restore it.
    If the above steps do not resolve the issue, contact Apple.
    You can find the full article here:
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    If you get to step 5, I recommend backing up your iPad before performing the restore:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/HT1766
    Additionally, if your iPad is not being recognized in iTunes, I recommend the following article.  I wasn't sure whether you were using a Windows or Mac computer, so I included the respective articles for each:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/TS1591
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I am having an elite book and i have an integrated sim card slot but when i insert a sim its not wrk

    mam/ sir
                  i nely bought my elite book from hp and i found out thats its having a sim slot but when i insert a sim its not responding at all and i am unable to use this slot can u pls help me so that i can use this slot

    Hi,
    You also need a WWAN card as well. You can not use the SIM without WWAN card.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Black screen and frozen will not respond have tried holding the buttons but nothing

    MY 32GB IPOD Touch , the screen is black and frozen .I have tried pressing the buttons to reset but no responce any ideas please?

    Have you tried the troubleshooting here:
    iOS: Not responding or does not turn on

  • Ipad "died" mid-app/screen saver and now not responding?

    Help!.... I was playing hte latest round of "song pop" app... left the ipad to answer the call of nature, and when I returned, the screen had locked (normal time out i thought)... but now none of the buttons have any effect!..
    I can't even turn it off!....
    Any ideas,  tried plugging in to laptop/itunes, but nothing happens!>.
    HELP! (please!)

    - Try the remaining steps here:
    iOS: Not responding or does not turn on
    - If not successful and you can't turn the iPod off, let the battery fully drain. After charging for at least an hour try again.
    - If still not successful then time for an appointment at the Genius Bar of an Apple store.

  • Ipad screen not responding, won't shut off either

    Ipad froze in middle of use. Can't turn off, Screen not responding. Has it died? Help!

    Hi..
    Troubleshooting help here >  iOS: Not responding or does not turn on

Maybe you are looking for

  • How to add one able beside "Go" button in OVS

    Hi all:     Can I add one lable/text beside "Go" button in OVS ?     Thanks a lot.

  • Change Release Stategy

    Hi Experts, I have defined 2 release strategy in PO for value below $100 and total value above $100 in SPRO. I have a scenario where the PO of value $90 gets released for the first time and the release strategy below $100 is triggered. Then another u

  • Authorization settings for BI in RSSM

    Hi SDN Experts,                          I have provided authorizations for 0Profit_ctr (Hierarchy) in RSSM, maintained a role in PFCG, assigned the User that role in SU01 and then publised the query in to that role.                                  

  • Yellow status after "No database operations necessary, data unchanged"

    Hi, I am loading master data (full) and for some packages I get the message "No database operations necessary, data unchanged" the processing remains with status yellow (no "processing end" message comes for those packages). In the end, I get a red s

  • Screensaver problem w/iPhoto.

    This is very strange. I go to System Preferences, Desktop & ScreenSaver and choose an iPhoto album to run as a screensaver. Some of the albums display the correct pictures, while other albums display pictures that are not in the selected album. I hav