Can't use any c++ code in android projects only c code is usable

Sysprogs forums Forums VisualGDB Can't use any c++ code in android projects only c code is usable

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21744
    user612
    Participant

    I came to a very strange problem

    I created the simple native activity for android and used ndk r17 and I have android sdks up to android 7

    I compiled the project as it is successfully

    later I added a cpp file and hpp file and wrote a very simple class that does no thing :

    class test {
    test() {}
    ~test() {}
    };

     

    and set thee STL to c++_shared and ABI to armeabi-v7a and using exceptions rtti as c++ features

     

    but once I hit the build button I got several errors like these :

     

    • identifier “class” is undefined
    • cannot open source file “asm/posix_types.h”
    •  identifier “__u16” is undefined
    • unknown type name ‘class’; did you mean ‘jclass’?

    and very much errors

    what is the problem here ???

    #21758
    support
    Keymaster

    Hi,

    Please double-check that your source files have the .cpp, not .c extension. Even if one .c file included a header file with C++ constructs, it would result in a build error.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.