Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT C/C++ code completion problem in NDK / Java project

I have an Android (Java) project that includes some native C/C++ code and I need it to be able to code complete on various C classes & functions. However the option to include where the (full) source is from does not seem to be available in the Android (Java) project.

Does anyone know of a way to either: 1) Trick Eclipse into including the necessary Project Properties panel item (side panel)? 2) Include the files manually through the use of some form of configuration file?

Thanks, Kevin

like image 297
Kevin Parker Avatar asked Dec 13 '22 10:12

Kevin Parker


1 Answers

There are two basic ways to setup a NDK builder in Eclipse:

  1. Creating a custom builder - a bit easier in setup and more portable but does not provide C++ auto-completion and you can not navigate to source by double-clicking in the error console. (This seems to be your case.)
  2. CDT-based builder - results in less portable configuration but provides all IDE features for JNI code.

Here is a good-looking tutorial for the CDT configuration:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/

To enable the code completion for external sources (and for standard Android headers) you need to open "Project properties" > "C/C++ general" > "Paths and symbols" and add your include paths to the list:

enter image description here

NDKROOT - an environment variable containing path to my NDK

like image 180
Andrey Kamaev Avatar answered Mar 23 '23 01:03

Andrey Kamaev