0
昨天,我複製並編譯了下面的代碼,它很好。但今天當我編譯代碼時,它給了我一個警告,並且不會運行.exe
。我是Objective-C中的新成員,我在窗口上使用GNUstep。從我的Objective-C代碼中的不兼容指針類型的分配
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;
}
非常感謝。它的工作! :) – miniplayground 2011-05-26 01:37:22