I want to execute a simple code in Termux(c++) but every time I get an error:
bash: ./test.cpp: Permission denied
Storage permission is on and gcc is installed.
Do I need root or something else?
As molbdnilo said, you should compile your source file first :
g++ test.cpp
And then execute the binary produced (the default name is a.out)
./a.out
Compile and run it in termux's own directory. Just start termux:
cd storage/
nano test.cpp
g++ test.cpp "./a.out"
You can run it!
C++ can't do it,you must compile first. And if it Python,you can add #!/usr/bin/env python
to first line,and in shell run chmod 744 xxx.py
,and then run ./xxx.py
.xxx.py is running.
I never used termux but would Like to suggest U following points for compiling
chmod 777 test.cpp
to grant the permission for read write and execute to all userssudo apt-get update
followed by sudo apt-get install g++
g++ test.cpp -o test
and use ./test
to execute the file. This is how it work in Linux systems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.