Search code examples
simulinkmatlab-compiler

Code generation of linked blocks in Simulink


I am trying to generate code of my Simulink Model. The model contains linked blocks and Level 2 S-functions. I am getting the following error when I press the Build Model Button

MyFluidProp_mod6.obj : error LNK2019: unresolved external symbol "double __cdecl pneu_fluids_PureGasProps_cp(double,class FluidProps &)" (?pneu_fluids_PureGasProps_cp@@YANNAEAVFluidProps@@@Z) referenced in function "double __cdecl cp_Fcn(double,class FluidProps &)" (?cp_Fcn@@YANNAEAVFluidProps@@@Z) 

Update: After tracking all required source files, and copying them to the current folder, I end up with the actual error:

C:\Program Files\Microsoft SDKs\Windows\v7.1\\include\winnt.h(135) : fatal error C1189: #error :  "No Target Architecture"  
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl.EXE"' : return code '0x2' 
Stop.

From previous posts, it appears that winnt.h has to be replaced by windef.h. But since it used internally (not by any of my source codes), I can't change it.

This is most probably to a missing link to one of the used libraries. But since I cannot supply any additional commands to the Build Button, I cannot specify the link. I also must admit that I didn't understand exactly the error message meaning.

Can anyone help?


Solution

  • Your most likely not telling the compiler where to look for the library containing the function in question. This is done on the Configuration Parameters -> Code Generation -> Custom Code tab. If you right click on the words "Include Directories:" then you can bring up the help, explaining what to put into where.

    enter image description here