Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gayanvirajith/5678f6610bb5229c6b2b to your computer and use it in GitHub Desktop.
Save gayanvirajith/5678f6610bb5229c6b2b to your computer and use it in GitHub Desktop.
Command to compile and run C++ programs in ubuntu

g++ foo.c where foo.c is the name of the program to be compiled. This will produce an executable in the same directory called a.out which you can run by putting this in your terminal - ./a.out

g++ -o output foo.c This will compile foo.c and you can type ./output to run the compiled code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment