需要一个简单的 Linux C++ IDE (Android NDK) [英] Need a simple Linux C++ IDE (Android NDK)
问题描述
我需要一个必须:
- 允许运行 ~/android-ndk-r7/ndk-build 脚本编译;
- 截取 gcc 输出并显示给我;
- 当我点击错误行时,转到错误位置:在提到的行打开提到的文件.
我有一个现有的大型 C++ 项目并将其移植到 Android/NDK.
I have a large existing C++ project and am porting it to Android/NDK.
(Code::Blocks 和 Eclipse 都没有做第三个.也许我错过了什么?)
(Neither Code::Blocks nor Eclipse do the 3rd. Maybe I am missing something?)
推荐答案
我为 Android NDK/JNI 开发配置了 Code::Blocks,但是有一个技巧.Codeblocks 相信它可以知道你使用什么编译器,并希望阻止你使用它不知道的东西.你必须欺骗它.
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.
- 创建一个空的代码块项目
- 添加源文件和头文件(手动)
- 在工作区(左窗格)中的项目上单击鼠标右键.您将看到一个菜单:
(首先转到 Properties 并指定它是一个自定义的 Makefile,然后 Build options) - 转到属性"并告诉 CB 它有一个自定义 Makefile.不要告诉它任何接近平台真相的东西:它会告诉你你没有所需的编译器,甚至不会尝试构建一些东西.
- 最后,在构建选项中,选择 GNU GCC 编译器,转到生成命令",然后编写您的自定义命令.(我个人创建了一个调用 ndk-build 的 Makefile——我更喜欢将脚本保存在文本文件中而不是 GUI 对话框中.您可能想要更改的项目是
-j 4
)
- 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:
( 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 这是我的 Makefile:
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
这篇关于需要一个简单的 Linux C++ IDE (Android NDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!