Question

I think this problem started when upgrading to the Juno Eclipse. I believe the C/C++ build environment was probably upgraded as well at the same time. The NDK was not upgraded.

We have a large mass of C code that compiles under several platforms. We are using the crystax-ndk (r6) to compile our C++ code. To know when we are compiling for Android, we have defined the following in the Android.mk

LOCAL_CFLAGS := -DANDROID_NDK \
            -DDISABLE_IMPORTGL \
                 ...

Then in some files we will include different headers depending upon the platform

#ifdef ANDROID_NDK
     ...

Our code compiles just fine and seems to run fine. However, when opening certain files the C/C++ code analyzer will find many errors. This appears to be because the analyzer doesn't know about the ANDROID_NDK defined variable.

Any idea why the code analyzer is not using the same #defines as the compiler? The code is almost uneditable with all the bogus errors the analyzer is reporting.

Was it helpful?

Solution

I saw you're comment about the analyzer you were refering to.

Eclipse CDT (C/C++ Development Toolkit) does not support parsing Android.mk yet neither does the NDK plugin add that functionality at the time of writing this.

Possible (ugly/annoying) workaround: Set up a header file setting the defines you are missing and include that header file to all files.

OTHER TIPS

Use LOCAL_CPPFLAGS for C++ files and LOCAL_CFLAGS for C files in your Android.mk

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top