【发布时间】:2011-09-01 13:33:37
【问题描述】:
昨天,我复制并编译了下面的代码,它很好。但是今天当我编译代码时它给了我一个警告并且不会运行.exe。我是 Objective-C 的新手,我在 window 上使用 GNUstep。
testString.m: In function 'main':
testString.m:5:13: warning: assignment from incompatible pointer type
** testString.m:5:13 it front of (=)
这是代码。
//testString.m
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSString *testString = [[NSString alloc] init ];
testString = "Here's a test string in testString!";
NSLog(@"testString: %@", testString);
return 0;
}
【问题讨论】:
标签: objective-c pointers types variable-assignment