C++ 'a.out' not recognised as a command


Having entered following command from linux terminal −

$ g++ helloworld.cpp

The a.out file should be created in the current working directory if the compilation is successful. Check if a.out is created.

To execute enter following from command line −

$ ./a.out

In most cases, output of your source program is displayed. However, as in your case, error message indicating a.out is not executable is appearing. See the properties of a.out and make it executable (if not already) by following command −

$ chmod +x a.out

You may require sudo privilege for this. In all probability this should work. all the best

Updated on: 10-Feb-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements