You will have to compile and link prog.e over on the other machine, and keep the executable ONLY over there. It looks like you copied a local version of the program to the remote box. This is not guaranteed to work, by any means.
There are two ways of dealing with this. One way is to compile prog.e statically. You must refer to your compiler documentation to learn how to do this, but you can always just try compiling with "-static" and see what happens.
Unfortunately, some compilers still output an executable which depends on a small shared library, provided with the compiler. So you can always use method two, which is this: Invoke the program as an argument to the env command. The env command allows you to specify environment variables and their values for the program you want to run. You might be familiar with this syntax (from sh, bash, ksh):
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib:/usr/local/lib $PWD/myprogram arg1 arg2
This problem is that this will not work for remote execution -- the rexec command uses these values, but the remote side reinitializes the values. The solution is env:
env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib $PWD/myprogram arg1 arg2
Works the same way, but now you can prefix your rexec command to the whole thing like this:
rexec -l user -p password host env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib $PWD/myprogram arg1 arg2
By the way, the "$HOME/lib" is for "demo" purposes only. So here's what you should do in "the general case":
rexec -l user -p password host env LD_LIBRARY_PATH="$LD_LIBRARY_PATH" PATH="$PATH" myprogram arg1 arg2
Since that might be a bit lengthy, you can create a shell function (or script) to do the ugly work for you: