我已经建立了一个静态库,可以链接到我的 iPhone 应用程序中。这个库使用了一些全局变量和函数,就像在 C 中一样。我的问题是,当使用例如:
extern
void do_stuff (const int a)
{
return a*a;
}
extern const int a_variable;
extern const int an_array[DEFINED_VALUE];
当我在代码中的任何位置使用此函数或访问这些变量时,编译器会告诉我
"_do_stuff" 引用自:tests.o 中的-[Object testMethod]
"_a_variable" 引用自:tests.o 中的-[Object testMethod]
"_an_array" 引用自:tests.o 中的 -[Object testMethod]
Symbol(s) not found Collect2: Id returned 1 exit status
有没有人遇到过这个问题?我知道我在做一些愚蠢的事情,我错过了一些关键的 Objective-C 或 C 概念,但我真的看不出是什么。所以我希望有人能帮助我。提前致谢。