Date: Jan 18, 2013 2:43 AM
Author: Frank Engels
Subject: Cannot compile "matlab function block" in linux

I have an Simulink model in which I use a matlbab function block. 
The block contains a simple calulation:
function power= fcn(espd,calLoad,maxTorque)
%#codegen
power = espd*calLoad*pi/60*maxTorque/100000*3600;

When I build the code an genereate it I get the following error:
Making simulation target "OBDFuelEstimator_sfun", ...


/usr/local/MATLAB/R2011b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/MATLAB/R2011b/stateflow/c/mex/include -I/usr/local/MATLAB/R2011b/stateflow/c/debugger/include OBDFuelEstimator_sfun.c

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

/usr/local/MATLAB/R2011b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/MATLAB/R2011b/stateflow/c/mex/include -I/usr/local/MATLAB/R2011b/stateflow/c/debugger/include OBDFuelEstimator_sfun_registry.c

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

/usr/local/MATLAB/R2011b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/MATLAB/R2011b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/MATLAB/R2011b/stateflow/c/mex/include -I/usr/local/MATLAB/R2011b/stateflow/c/debugger/include c2_OBDFuelEstimator.c

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/


/usr/local/MATLAB/R2011b/bin/mex -silent LDFLAGS="\$LDFLAGS " -output OBDFuelEstimator_sfun.mexglx OBDFuelEstimator_sfun.o OBDFuelEstimator_sfun_registry.o c2_OBDFuelEstimator.o /usr/local/MATLAB/R2011b/stateflow/c/mex/lib/glnx86/sfc_mex.a /usr/local/MATLAB/R2011b/stateflow/c/debugger/lib/glnx86/sfc_debug.a -L/usr/local/MATLAB/R2011b/bin/glnx86 -lfixedpoint -lut -lmwmathutil -lemlrt -lmwblascompat32 -L/usr/local/MATLAB/R2011b/bin/glnx86 -lippmwipt

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

mex: link of ' "OBDFuelEstimator_sfun.mexglx"' failed.

gmake: *** [OBDFuelEstimator_sfun.mexglx] Error 1



### Build procedure for model: 'OBDFuelEstimator' aborted due to an error.

When I remove the matlab function block no error occurs and the compilation works fine.

Does anybody has a solution for thsi problem, I am using R2011b