2013-03-11 72 views
0

我有一個.c文件(無頭文件),其中包含一些函數。我有另一個.mm文件應該在該.c文件中調用函數。這在我從中取得文件的xcode項目中起作用。但是,當我將這個文件添加到我自己的項目中並執行此操作時。我收到以下錯誤:在.mm文件中使用無頭文件的C文件objective-c/xcode

Undefined symbols for architecture armv7: 
    "Init(Context*)", referenced from: 
     -[EAGLView initWithFrame:] in EAGLView.o 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我做這行我.mm文件:

int Init(Context *context); 

回答

0

也許還有一個原因.c文件沒有一個頭 - 功能裏面有意味着是私人的,並且有機會被定義爲static。如果是這種情況,請刪除static關鍵字並重新編譯。

+0

函數在.c文件中是這樣的,非靜態的。 int Init(Context * context) { ... } – user2158259 2013-03-11 19:46:08

+0

@ user2158259在這種情況下,其他的錯誤。如何提供更多信息? – 2013-03-11 19:48:26

+0

我決定把這個特定的.c文件分解爲objective-c,並解決了我遇到的問題。感謝您的幫助。 – user2158259 2013-03-13 15:45:23