Search code examples
androidc++compiler-errorsandroid-cameraandroid-source

Android Source Code Compilation issue


i am working on one of C++ Application, where i need to interface with Android Source Code, i got this Source Code from below URL

https://github.com/android

Now When i am Compiling my application which uses Camera module, then it has many dependencies like utils,binder,gui,system. by this way i am including every header files which camera module of Android depends depends on.

but i am stuck with following error:

In file included from jni/headers/camera/ICamera.h:22:0,
             from jni/headers/MyCamera.h:4,
             from jni/headers/VideoWrapper.h:4,
             from jni/src/com_example_jnitest_VideoJava.cpp:2
jni/headers/binder/Parcel.h:31:7: error: template argument
required for 'class Flattenable'
class Flattenable;
   ^
jni/headers/binder/Parcel.h:105:37: error: invalid use of 

template-name 'android::Flattenable' without an argument list
 status_t            write(const Flattenable& val);
                                 ^
jni/headers/binder/Parcel.h:160:30: error: 'Flattenable' is not a type
 status_t            read(F

my Question is:How to get out of this error??


Solution

  • Whenever Any class Template need to be pre-declaration in another class or Anywhere then we need to give it with template

    e.g: in Parcel.h file of Android source, pre-declaration of class Flattenable is done as below:

    class Flattenable;
    

    but actually it should be:

    template <typename T> class Flattenable;
    

    because class Flattenable is Template class. However i Amazed how this things not taken care into Android Source Code..!!