You need to have the gateway function mexFunction in your source code:
If you have that set up properly, and the file is in the current directory, then yes all you do is enter this at the command prompt:
mex hello.cpp
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!