我收到Apple Mach-O链接器错误:
Undefined symbols for architecture arm64:
"_TestFunction", referenced from:
-[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
以下是重现错误所需的所有步骤:
void TestFunction();" 添加到我的.hvoid TestFunction(){}" 添加到我的.mm中TestClass.h我的ViewController.m并尝试TestFunction()从我的viewDidLoad 调用.我正在做一些Core-Audio工作,需要在我的MIDI回调中进行一些C++调用,所以我不能进行任何ObjectiveC方法调用,因为它们会阻塞音频线程.
也许Xcode将TestFunction()视为C++调用,因此不会从纯ObjectiveC类中获取它?有没有办法告诉Xcode它是C函数?