Android NDK Error (Eclipse) and workaround

Source: Internet
Author: User

In the ANDROIDNDK development process, the C/D + + code written under the JNI folder in the engineering directory usually appears with several types of errors as follows:
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: ... '

1 Error form one: No import header file (This is the biggest error, will cause a series of errors below). There are usually the following forms of expression:

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 the item--Properties--left/C + +--Paths and Symbols--right includes---GNU C + + (. cpp)-- Add-->${ndkroot}\platforms\android-18\arch-arm\usr\include (tips: the NDK platforms\ here Android-18 must be consistent with target in the properties of your project).

2 Error Form 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.

3 Error Form three: Invalid arguments ' candidates are:void * malloc (?) ', Invalid arguments ' candidates are:void * memcpy (void *, cons t void *,?) '

Workaround: Add a path (see workaround above): ${ndkroot}\toolchains\arm-linux-androideabi-4.8\prebuilt\windows\lib\gcc\ Arm-linux-androideabi\4.8\include


Solved the mistake, everyone has fun

Android NDK Error (Eclipse) and workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.