0
votes

I want to integrate C code using the MATLAB function block (Integrate C Code). When I run the model the next error occurs:

MEX completed successfully.

/.../MATLAB/R2015a/bin/mex -silent LDFLAGS="\$LDFLAGS " -output untitled1_sfun.mexa64 untitled1_sfun.o untitled1_sfun_registry.o c2_untitled1.o mysource.o

L/.../MATLAB/R2015a/bin/glnxa64 -lmwsf_runtime-

L/.../MATLAB/R2015a/bin/glnxa64 -lfixedpoint-

L/.../MATLAB/R2015a/bin/glnxa64 -lut-

L/.../MATLAB/R2015a/bin/glnxa64 -lemlrt-

L/.../MATLAB/R2015a/bin/glnxa64 -lmwmathutil-

L/.../MATLAB/R2015a/bin/glnxa64 -lmwblas-

L/.../MATLAB/R2015a/bin/glnxa64 -lmwsl_log_load_blocks-

L/.../MATLAB/R2015a/bin/glnxa64 -lmwsimulink-

L/.../MATLAB/R2015a/bin/glnxa64 -lmwipp c2_untitled1.o: Function `sf_gateway_c2_untitled1':

c2_untitled1.c:(.text+0x168d): reference to `mysource' not defined collect2: error: ld return 1 out state

gmake: *** [untitled1_sfun.mexa64] Error 255

mysource is my C code to integrate. I call it in the MATLAB function with 'coder.ceval('mysource',u1,u2,u3);'

1
Try adding the directory to the "Include directories" list in the "custom code" panel.Navan
Thanks for your answer. I solved it with your suggestion. A new error has occurredJLP
Posted my comment as answer. Please post your new error as a new question.Navan

1 Answers

0
votes

When generated code is compiled MATLAB paths are not included. You need to specify include directories using the option "Include directories" under "Custom code" panel. This will use the respective compiler option (for example -I) to include this directory for header search when compiling generated code.