Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot add C/C++ Nature to Android project in Eclipse

I am writing an Android app which will use OpenCV so I need to use C++ for parts of my app. I am following the tutorials on OpenCV which explain how to include native code in your app. I want to build the native parts using CDT which I have downloaded and installed.

I am following these steps http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html#cdt-builder

but am stuck at the part that tells me to add C/C++ nature to my project.

I cannot find this option in Eclipse anywhere. It doesn't appear when I right click my project and I have tried adding it from Window >Perspective >customize this perspective >Shortcuts >C/C++ and it isn't there either.

Is there some way that my project could already have C/C++ nature?

I am using Eclipse Juno with ADT.

I'm very new to Android development so I apologise if this is a silly question. Thanks in advance for any help/guidance.

like image 991
Peek Avatar asked Oct 18 '25 16:10

Peek


1 Answers

If you have an Android app project, you have an Android Tools item in project context menu (i.e. click right mouse on the project name in the left pane).

There you will find Add Native Support. It will ask you an irrelevant question about the name of the shared library, and it will add an empty C++ file to your jni folder. Your project will now have C/C++ nature in addition to its Android/Java nature.

like image 97
Alex Cohn Avatar answered Oct 20 '25 06:10

Alex Cohn