C++ a.out file downloading and running outside of c9.io terminal


New to programming and I am trying to download my a.out file to submit to my course instructor. The problem is: the ‘a.out’ file only seems to run in the c9.io terminal, but when I download it to a Mac terminal and run ./a.out I receive a permission denied - also the downloaded (from c9) a.out file does not have an exe icon (like it would if I compiled in Mac terminal) instead it is a blank icon. even if I use the command: sudo ./a.out the file will still not run. Any ideas?


Try running chmod +x a.out then running it again. This command makes it executable.


After I apply chmod +x a.out to the downloaded a.out file it does become executable, however, I receive the following error:

-bash: ./a.out: cannot execute binary file

If I compile text file on the Mac it runs fine.


files compiled on linux won’t run on mac, unless you use special tools to compile for mac http://stackoverflow.com/questions/2786240/how-to-compile-intel-mac-binaries-on-linux, but in that case it won’t run on mac. You probably should submit the source code instead of binary file


I assumed if it was a g++ compiler mac or Linux it would be the same. Thank-you for taking the time share this!

I’m using a Chromebook (samsung cb plus) as I don’t want to take my MBP to campus (an’t afford to replace it if it gets stolen or damaged). So c9.io is really going to help me do this.

Have a good week,