我宣佈類似下面Accesing全局變量給出鏈接錯誤目標C
extern NSString *name;
@interface viewcontrollerOne{}
在實現文件
我正在訪問一個全局變量在一些方法一樣
-(void)someMethod
{
name = @"hello";
}
一個全局變量,但這是給鏈接器錯誤。
"name", referenced from: -[viewcontrollerOne someMethod] in viewcontrollerOne.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
請訪問以下網頁 的http:// stackoverflow.com/questions/5026083/objective-c-linking-error-with-extern-variable – svrushal