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

C++Server Side ProgrammingProgramming

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

Published on 08-May-2018 12:59:16