Here is a simple make file to get you started:
Makefile
 # root directory of MATLAB installation MATLABROOT="/usr/local/matlabR2010a" all: engdemo engdemo: g++ ${MATLABROOT}/extern/examples/eng_mat/engdemo.cpp -o engdemo \ -I${MATLABROOT}/extern/include \ -L${MATLABROOT}/extern/lib -llibeng -llibmx clean: rm -f engdemo *.o 
Just use it by calling make , then running the program as ./engdemo
You can also compile this directly from within MATLAB. First, make sure you mbuild -setup at least once:
 >> srcFile = fullfile(matlabroot,'extern','examples','eng_mat','engdemo.cpp'); >> mbuild(srcFile, '-llibeng','-llibmx') >> !engdemo