This problem may come when you are trying from wrong directory...
I suggest you to check for directory.
Update the OS by: sudo apt-get update.
The final option is to remove the exixting gcc compiler and install the new one.
You can also try this:
g++ -o [fileName] [executable name]