Firts, check if you have g++ instaled.
Run this on console:
g++ -v
If show version, g++ installed.
Now, create a simple shell script to compile you cpp file
#/bin/bash
# gpp compiller
g++ -pedantic-errors -ansi -Wall -o $1 $1.cpp
Now, to compile the str.cpp use this:
gpp str