How do I fix Eclipse CDT Error "Function 'isdigit' could not be resolved" with Android NDK?

android, android-ndk, eclipse, eclipse-cdt, java-native-interface

Solution

I worked around this issue via the approach I suggested in my question and haven't been able to find a better way yet.

Problem

I am using Eclipse Indigo with an Android/NDK mixed project. I've added C++ nature and almost everything is working. Automatic builds work; that is, when I edit a file ndk-build is invoked and completes successfully - no build errors. Mouseover code assist works (the little window pops up with information about the function). If I place the cursor on an include line and press F3, a relevant header file open (not the one I would expect based on my configuration, but a relevant one - maybe a clue?). If I select the following line in my .cpp file, it opens $NDKROOT/platform/android-3/arch-arm/usr/include/ctype.h: ``` #include <ctype.h> ``` (isdigit is defined in this file) However, Eclipse insists that isdigit is not defined. I have read many posts suggesting that either the static analyzer or the indexer is to blame, but I've tried many of the suggested solutions to no avail. If I add a line like the following, the error goes away and mouseover code assist for the function works: ``` extern int isdigit(int); ``` Again, this is not a linker error or a compiler error - ndk-build completes with no errors. This is something inside eclipse. Thanks for taking a look! Edit: I now believe this to be a Code Analysis problem. A better solution is to edit the Code Analysis options to make "Function could not be resolved" be a warning instead of an error. That way you can see the warnings in Problems view, but continue to work. If the function is REALLY missing, the compiler will tell you! I also have a new theory, that the problem is with the Code Analyzer following symlinks, because all of the "missing" functions are in symlinked include files. Would love any input on this theory.

Original source