facebook/three20 — Issue #779: Three20 linking fails for Obj C++ projects in debug builds 
Author: hisham
Created: 2012-02-16 19:12:45+00:00
State: open

I get this error:

Undefined symbols for architecture i386:

"TTIsInDebugger()", referenced from: ...my code stack here... ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

After a few days of research, the reason for this error is because I have .mm files in my project. Since our project has obj-c++ enabled (for the mm files), C function declarations are actually by default linked as C++, but three20 is compiled as regular C, hence, the linker is unable to find the function declared in any object file.

To fix, modify src/Three20Core/Headers/TTDebug.h as follows:

#if TARGET_IPHONE_SIMULATOR

- int TTIsInDebugger();
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int TTIsInDebugger();
+
+#ifdef __cplusplus
+}
+#endif
+