Creating a Root or Cling Executable file

I wanted to create an executable, that i can call in a bash script, with c++ code, which when i run the bash scripts will interprete the c++ code, how can i achieved that. The root or cling executable will contains other functionalities that will be common among all scripts that calls it. How can i achieved it
Bash scripts will look like
#! /usr/local/bin/test_executable

int main ( int argc, char *argv )
{

cout << " SUCCESSFUL" << endl;

exit ( 0 );
}

This is a duplicate of Root or Cling and Bash scripting