by default, eclipse cdt does not run code with build errors, but maybe you have checked the option always launch without asking checkbox.

you should go to windows menu->preferences->run/debug->launching->continue launch if project contains errors and check prompt option instead of always. using this, eclipse cdt will prompt you if errors exists during building or launch your binary if it has been compiled without errors.

Related Query

More Query from same tag