'NSString undeclared'
This is extremely silly, but I can't figure out how to use an NSString in my iPhone app musings.
I haven开发者_如何学JAVA't imported anything special (just stdio.h). When I tried declaring:
NSString *test = @"Hello World"
and compiled, I get the error: 'NSString undeclared'
How do I fix this? Also, when I try adding
#import <Foundation/Foundation.h>
I get 3951 build errors.
I haven't imported anything special (just stdio.h)
.
You should #import <Foundation/Foundation.h>
You Application
should be of type Foundation
You need to import Foundation.h
. You probably don't need or want stdio.h
.
Use
NSString *test=[NSString stringWithFormat:@"Hello World"];
Cheers
This is also silly. Did you put a semicolon after the line?
精彩评论