Termux权限被拒绝

Termux permission denied

本文关键字:拒绝 权限 Termux      更新时间:2023-10-16

我想在Termux(c++(中执行一个简单的代码,但每次我都会遇到错误:

bash: ./test.cpp: Permission denied
Storage permission is on and gcc is installed. 

我需要根还是其他什么?

正如molbdnilo所说,您应该首先编译源文件:

g++ test.cpp

然后执行生成的二进制文件(默认名称为a.out(

./a.out

在termux自己的目录中编译并运行它。刚开始termux:

cd storage/ 
nano test.cpp
g++ test.cpp "./a.out" 

你可以运行它!

C++做不到,必须先编译。如果是Python,您可以将#!/usr/bin/env python添加到第一行,并在shell中运行chmod 744 xxx.py,然后运行./xxx.py.xxx.py。

我从未使用termux,但我想建议U以下几点用于编译

  • 使用chmod 777 test.cpp向所有用户授予读写和执行权限
  • 将g++与gcc一起使用来编译C++文件使用sudo apt-get update,然后使用sudo apt-get install g++
  • 使用g++ test.cpp -o test编译并使用CCD_ 8来执行该文件。这就是它在Linux系统中的工作方式