Eclipse integrated ndk Development Environment

Source: Internet
Author: User

1. Install the C/C ++ environment plug-in of Eclipse: CDT. Here, install it online.

First, log on to http://www.eclipse.org/cdt/downloads.php and download the CDT that matches your eclipse( the installation method is the same as adt ).

2. Click the Help menu and find the Install New Software menu.

3. Click Add to enter the local adt address. After the plug-in list is displayed, Select All. Then, Select next to complete the installation.

4. After the installation is complete, right-click a new project in eclispe. If the c/c ++ project appears, your CDT plug-in is successfully installed!

6. Configure the C/C ++ Compiler

(We recommend that you first compile with the command line, then study the examples in google ndk samples, and then study silly compilation)

1. Open eclipse, import the hello-jni example that comes with ndk, right-click the project name, and click Properties to bring up the configuration interface, and then click Builders to bring up the compilation tool list of the project, click New to add a New compiler. The add page is displayed. Select Program and click OK.

2. The add interface appears. First, name the compilation configuration, for example, C_Builder.

Set Location to <your cygwin installation path> \ bin \ bash.exe program, for example, E: \ cygwin \ bin \ bash.exe, and set Working Directory to the <your cygwin installation path> \ bin Directory, example: E: \ cygwin \ bin

Set Arguments

-- Login-c "cd/cygdrive/e/android-ndk-r5/samples/hello-jni & $ NDK/ndk-build" (unchangeable, -- login-c is what Shenma means, and I don't understand it either)

In the above configuration,/cygdrive/e/android-ndk-r5/samples/Hello-JNI is the directory of the program you are currently compiling, $ ndk is the environment variable of the previously configured ndk, these two parameters are configured based on your specific installation directory. Other parameters do not need to be changed. The parameters of arguments are actually passed to the bash.exe command line program to enter the program directory to be compiled, then run the ndk-build Compilation Program

3. Switch to the refresh tab and hook refresh resources upon completion

4. Switch to the build options tab and check the last three items.

5. Click specify resources, select the Resource Directory, and select your project directory.

6. Click "finish" and click "OK" to save the configuration. Note: If the compiler you configured is under another compiler, remember to set it to the first place by clicking the "up" button, otherwise, the compilation of C code is later than that of Java code, which may cause your C code to be compiled twice before you can see the latest modification.

7. You must be tired after this process. Congratulations again, the compilation configuration is complete. Now, let's test whether automatic compilation can be performed, open the hello-jni.c file in the project JNI directory and prompt hello from JNI! Change it to another text, such as hello, my name is Alex., and then run your program in the simulator. If the simulator displays your latest modified text, then congratulations! You have all configured successfully!

Related Article

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.