MATLAB: Am I unable to build a model that contains multiple library block instances in Stateflow 5.1.1 (R13SP1)

buildchart;instanceslibrarylinemultiplenamenewpathstateflow

I have a model which contains multiple instances of my library block. When I try to build the model, I receive the following error:
test.obj : error LNK2001: unresolved external symbol _sf_m1_c4_SSF_Test
..\test.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
When I have only one copy of the library block, I receive no errors. Why is this occurring?

Best Answer

This has been verified as a bug in Stateflow 5.1.1 (R13SP1). If there are multiple instances of a library chart such that the full path name of the instances have a new-line character in it, Stateflow generates uncompilable code. The current workaround is to:
1. Close all models and libraries (BDCLOSE)
2. Open the library where the block is located
3. Unlock the library
4. Remove the new-line character from the library block name and the names of any subsystems which contain the block in the model heirarchy
You can confirm that there are no newline characters in the model name by selecting the block, then typing GCB at the MATLAB command line.
With this change to the model, the generated code compiles.