I need an IDE that must:
- allow running the ~/android-ndk-r7/ndk-build script for compilation;
- intercept the gcc output and show it to me;
- when I click on an error line, go to error location: open the mentioned file at the mentioned line.
I have a large existing C++ project and am porting it to Android/NDK.
(Neither Code::Blocks nor Eclipse do the 3rd. Maybe I am missing something?)
Advertisement
Answer
I configured Code::Blocks for Android NDK/JNI development, but there’s a trick. Codeblocks believes that it can know what compiler you use, and wants to stop you from using something it does not know. You have to trick it.
- Create an empty codeblocks project
- Add your source and header files (manually)
- Click the right mouse button on your project in the workspace (the left pane). You will see a menu:
(EDIT: First go to Properties and specify it’s a custom Makefile, then to Build options) - Go to “Properties” and tell CB it has a custom Makefile. Do not tell it anything close to the truth about the platform: it will tell you that you don’t have the required compiler and will not even attempt to build something.
- Finally, in the Build options, select the GNU GCC Compiler, go to the “Make commands”, and write your custom commands. (Personally I created a Makefile that invokes ndk-build — I prefer to keep scripts in the text files rather than in GUI dialogs. The item that you might want to change is
-j 4
)
And one final note: if your configuration does not work, you get no meaningful diagnostics.
PS Here’s my Makefile:
all: @echo '====all====' pwd;~/android-ndk-r7/ndk-build -j 4 clean: @echo '====clean====' pwd;~/android-ndk-r7/ndk-build clean .PHONY: clean .PHONY: all