You can easily use ant for building C/C++ projects. You need to use the exec tag for this purpose where you can specify the command to be run. It can be gcc or g++ or make(in case you are invoking make file; which is the norm), or any other command for that matter.
See the following example...