Quick-and-dirty g++ compilation

I am creating a small bash file that will take one argument and compile it:

#!/bin/bash 

OUT=${$1%.cpp} # C++ source files always end in .cpp 
g++ -Wall $1 -o $OUT 
chmod 777 $OUT

The error message says 'bad substitution', namely where OUT is defined. How to fix this?

Change OUT=${$1%.cpp} to OUT=${1%.cpp}

Note the change from $1 to 1