C + + code written under the Jni folder in the project directory at compile time, you will typically encounter several types of errors such as the following:
1, unresolved inclusion:<xxx>
2. Syntax error
3, Function ' XXX ' could not being resolved
4. Type ' XXX ' could not being resolved
5. Symbol ' XXX ' could not being resolved
6, Method ' XXX ' could not being resolved
7. Invalid arguments ' candidates is: ... '
Cause of Error:
Most of the situation is due to the absence of the relevant header files, and some are due to invalid parameters (of course invalid parameters may also be because the header file is not joined, see below).
Related error Resolution-Add header file:
Error content one:
1, unresolved inclusion: <jni.h>, unresolved inclusion: <stdio.h>, unresolved inclusion: <malloc.h>, Unresolved inclusion: <android/log.h> 、...
2. Function ' __android_log_print ' could not being resolved, type ' jnienv ' could not being resolved, type ' jstring ' could not being res olved, Type ' Jclass ' could not being resolved, function ' malloc ' could not being resolved, function ' memcpy ' could not being Resolved, Method ' Findclass ' could not being resolved, Type ' jsize ' could not being resolved, Symbol ' NULL ' could not being Resolved 、...
Workaround:
Right-click Items--Properties--left/C + +-Paths and Symbols--right includes---GNU C + + (. cpp)--ADD
| __>gnu C (. c) __|
${ndkroot}\platforms\android-18\arch-arm\usr\include
Error content two:
1, unresolved inclusion: <iostream>, unresolved inclusion: <fstream>, Symbol ' std ' could not being resolved 、..
2. Type ' FStream ' could not being resolved, Symbol ' in ' could not being resolved, method ' SEEKG ' could not being resolved, method ' read ' could not being resolved 、...
Workaround:
Add path (see workaround above):
${ndkroot}\sources\cxx-stl\gnu-libstdc++\4.8\include,${ndkroot}\sources\cxx-stl\gnu-libstdc++\4.8\libs\ Armeabi\include
Error content three:
Invalid arguments ' candidates are:void * malloc (?) ', Invalid arguments ' candidates are:void * memcpy (void *, const void *, ?)‘
Workaround:
Add path (see workaround above):
${ndkroot}\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.8\include
Related error resolution-symbol substitution:
Sometimes this error is encountered at compile time: Invalid arguments ' candidates are:std::basic_istream<char,std::char_traits<char>> & Read (char *,?) ', although we have added the corresponding header file, but still have invalid parameters such as error, error message in the '? ' Represents an invalid parameter.
Encountered such errors, you can index the corresponding function (CTRL + click the function) read, see the function definition of the parameter type, the function index to the header file of the parameter type is streamsize, but use the long.
Workaround:
Right-click Items--Properties--left/C + +-Paths and Symbols--right Symbols---GNU C + + (. cpp)--ADD
| __>gnu C (. c) __|
The value of name: Streamsize,value value: Long
After the add is complete, click OK and the error disappears.
Eclipse's NDK compilation-a common error resolution record