Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-14-2010, 05:53 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 2
skiabox is on a distinguished road
Default Passing argument 1 of 'NSLog' from incompatible pointer type

I get this error in the first NSLog command of the main :

Here is the complete code :

Rectangle.h :

Code:
//
//  Rectangle.h
//  rectangleProject
//
//  12/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>


@interface Rectangle : NSObject 
{
	int width;
	int height;
}

@property int width, height;
-(int) area;
-(int) perimeter;

-(void) setWidth: (int) w andHeight: (int) h;

@end
Rectangle.m :

Code:
//
//  Rectangle.m
//  rectangleProject
//
//  12/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "Rectangle.h"


@implementation Rectangle

@synthesize width, height;

-(void) setWidth:(int) w andHeight: (int) h
{
	width = w;
	height = h;
}

-(int) area
{
	return width * height;
}

-(int) perimeter
{
	return (width + height) * 2;
}

@end
rectangleProject.m :

Code:
#import "Rectangle.h"
#import <stdio.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // insert code here...
    Rectangle *myRect = [[Rectangle alloc] init];
	
	[myRect setWidth:5 andHeight:8];
	
	NSLog("w = %i, h = %i", myRect.width, myRect.height);
	NSLog(@"Area = %i, Perimeter = %i", [myRect area], [myRect perimeter]);
	[myRect release];
	
    [pool drain];
    return 0;
}


Any ideas?
Thank you.
skiabox is offline   Reply With Quote
Old 12-14-2010, 09:31 AM   #2 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,176
Kalimba is on a distinguished road
Default

Quote:
Originally Posted by skiabox View Post
rectangleProject.m :

Code:
#import "Rectangle.h"
#import <stdio.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // insert code here...
    Rectangle *myRect = [[Rectangle alloc] init];
	
	[myRect setWidth:5 andHeight:8];
	
	NSLog(@"w = %i, h = %i", myRect.width, myRect.height);
	NSLog(@"Area = %i, Perimeter = %i", [myRect area], [myRect perimeter]);
	[myRect release];
	
    [pool drain];
    return 0;
}


Any ideas?
Thank you.
You're missing the bit in RED, above.
__________________
~~ Word Flurry ~~ App Store / Website / Facebook
Kalimba is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 481
15 members and 466 guests
7twenty7, AlanFloyd, AppsBlogger, David-T, iAppDeveloper, imac74, Jaxen66, lovoyl, Music Man, mutantskin, Sami Gh, SLIC, solardrift, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:12 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0