4ntoine
4ntoine

Reputation: 20432

Is there any Java-based C/C++ compiler?

I understand that if it even exists it's N times slower than compiler written in native code and compiled for concrete arch. But anyway.

The main purpose is to compile few small c/c++ source files on android device (arm/x86, linux-based os, dalvik jvm). The sources can be created on users android device and compiler should work on users device too.

Any thoughts?

Upvotes: 2

Views: 1686

Answers (4)

Janus Troelsen
Janus Troelsen

Reputation: 21298

I see several approaches to getting a compiler on your Android device:

Linux on Android

Full blown virtual machine

Compiling to assembly and assembling

From C source to assembly

From assembly to native code

Compiling to JVM bytecode and interpreting

From C source to JVM bytecode

JVM interpreters for the JVM

Upvotes: 1

4ntoine
4ntoine

Reputation: 20432

Well, after few weeks of research i can say there is no such thing in nature. For android you should use native compiler but you'l have a lot of compatibility issues so get ready to apply patches, catch exceptions and dive into hundreds of megabytes of native code..

Upvotes: 1

Synxis
Synxis

Reputation: 9388

There is C4droid, which is an IDE and a C++ compiler on Android. Some plugins enable you to use libraries, such as the SDL, or to use gcc.

If you want to compile really small sources (1 file, no custom libs), you can use codepad or liveworkspace to code on your smartphone. The code is not compiled as an executable, you just see the output (error, stdout, ...).

Upvotes: 2

fbafelipe
fbafelipe

Reputation: 4952

If your objective is to compile c/c++ files on an android device, you can still use a C++ compiler written with C++ if you use NDK

Upvotes: 2

Related Questions