Ok so after building my code there are two files created the source code in .cpp for c++ and the exec which runs on the terminal ,i uploaded the exec file onto forums to share it to other mac users but after downloading the exec file it cant run at all on the terminal,is there an extension that should be included eg- project.exe that should make it run on the terminal
Asked
Active
Viewed 66 times
1 Answers
0
After the file (let us assume it is called foo
) has been downloaded it won't have the executable bits set:
$ ls -l foo
-rw-r--r-- 1 f.nas users 2111 Sep 13 10:07 foo
$ # Set executable bits
$ chmod +x foo
$ ls -l foo
-rwxr-xr-x 1 f.nas users 2111 Sep 13 10:07 foo
$ # Now we can run it.
$ ./foo
This is the foo program
$
Also, don't forget that the current directory (.
) is not usually in the PATH, so you need to use ./
to specify the pathname of the program.

Martin Bonner supports Monica
- 28,528
- 3
- 51
- 88
-
@F.NAS: If this was helpful to you, please "accept" the answer by clicking on the tick mark, and vote for the answer by clicking the upward pointing triangle above the answer score. (By doing this, you help indicate which are good answers, and which bad.) – Martin Bonner supports Monica Sep 13 '16 at 13:50
-
oh right sorry about that it was helpful. – Filimoni Naisua Sep 14 '16 at 08:23