I cut&pasted the below code from a previous question into a file called \"avishay.cpp\" and then ran
gcc avishay.cpp
only to get the f
To compile source.cpp, run
g++ source.cpp
This command will compile source.cpp to file a.out in the same directory.
To run the compiled file, run
./a.out
If you compile another source file, with g++ source2.cpp, the new compiled file a.out will overwrite the a.out generated with source.cpp
If you want to compile source.cpp to a specific file, say compiledfile,
run
g++ source.cpp -o compiledfile
or
g++ -o compiledfile source.cpp
This will create the compiledfile which is the compiled binary file. to run the compiledfile, run
./compiledfile
If g++ is not in your $PATH, replace g++ with /usr/bin/g++.