Running C++ Executable Compiled in Termux in Flutter for Android

72 views Asked by At

I'm attempting to execute a standalone C++ executable, compiled in the Termux environment, within my Flutter app for Android using Process.run('./hello', []). However, I'm facing "No such file or directory" errors. The executable is correctly placed with the required permissions.

  • Is it technically feasible to run C++ executables compiled in Termux in a Flutter app on Android - using Process.run?
  • If yes, what might be causing the issue of not locating the executable?

I compiled a simple C++ program using Termux (g++ -o hello hello.cpp) and attempted to execute the resulting standalone executable within my Flutter app for Android. The Dart code for execution is as follows:

ProcessResult result = await Process.run('./hello', []); I expected the C++ executable to run successfully, printing "Hello, World!" as intended. However, I encountered a "No such file or directory" error during execution. The executable is in the correct location and has the necessary permissions.

I'm seeking insights on whether running standalone C++ executables compiled in the Termux environment is technically feasible within a Flutter app on Android, and if so, guidance on addressing the issue.

0

There are 0 answers