-3

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

1 Answers1

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.