I have a similar problem, but I am struggling to solve it. When I try to build the model, I get the following error:
ntox86-g++-3.3.5: sfunc_teste2.o: No such file or directory
My S-function calls a .c file named "sfunc_teste2.c". It works very well in Simulink environment. However, when I build the model it fails to generate the code and do not find the file "sfunc_teste2.c".