How to make bash script abort?

I have a little bash script that includes make to compile with g++ and then a statement to actually run the compiled program. When it (the script) gets a syntax error, it does not abort and continues to run the previous version of the program.

How can I make the script abort when g++ generates a syntax error so it does not run the program again?

Thanks,
Siegfried

check the return status of g++