开发者

How to compile and run a C/C++ program on the Android system (like MinGW on the Windows)?

I want to compile 开发者_如何学JAVAand run the C/C++ program on the Android phone program (like G1).

For example, I write a "Hello World.c" program, then compile and run it on my Android phone system.

I have never used MinGW to run my code on my Windows system, so I also want to do it on the Android phone system.


At the time of the other answers, it may have been true that there were no development options. However, that area is changing quickly. There are several projects now where you can develop in some languages. Not all utilities support all ansi standards of the languages yet. As an example the project C4droid seems to aim to give full ansi C/C++.

https://play.google.com/store/apps/details?id=com.n0n3m4.droidc&hl=en


I'd recommend CppDroid - new free C/C++ IDE and compiler on Android. It has a lot of included C/C++ examples and tutorials. YouTube: https://www.youtube.com/watch?v=4T5qNP6xJ6Y#t=14 Blog: http://cppdroid.blogspot.com, Google Play: https://play.google.com/store/apps/details?id=name.antonsmirnov.android.cppdroid


The only way of using C/C++ in Android is to use the Android NDK.



today i just tried a new thing
it is super-hacky but works great after you set it up.
first root your phone(use something easy like z4root).
and follow the instructions here:
http://www.gphone.org.hk/cgi-bin/ch/threaded_show.cgi?tid=69&pid=222&h=1

If it is hard for you to use adb, then your just like me.use QuickSSHd.
DO NET SET THE SAME PASSWORD FOR QuickSSHd and OpenSSH.it won't make any changes in the process, but helps you not to get confused.
After you done everything,
be sure that the last few statements have worked correctly./this one may hurt

After you make sure than OpenSSH is installed Correctly.
Close QuickSSHd and ssh into your Debian.

then you can
apt-get install g++

Update to squeeze after you make sure it works.

And have fun.

Hint: never close the shell in the process == use usb network instead of wifi if possible

Any questions, I'm ready.


You can use clang from within the terminal emulator Termux. It's all free! I installed Termux through the Play Store, then once I got to the terminal, i used:

pkg install clang

clang++ hello.cpp -o hello.o

https://play.google.com/store/apps/details?id=com.termux

If you are unfamiliar with using a terminal emulator, check this page: https://www.learntermux.tech/2020/01/basic-commands-in-termux.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜