为什么编译器在提供的代码上给我以下错误消息:“初始化程序元素不是常量”?相应的C/C++代码在gcc下编译完美无瑕。
#import <Foundation/Foundation.h>
const float a = 1;
const float b = a + a; // <- error here
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[pool drain];
return 0;
}