Why do I get linker errors as below (seems that the compile can't recognize the trunc function)while building a Simulink model to dll for Canape. And my compile environment is based on Windows 10 / MATLAB R2016b / Microsoft Windows SDK 7.1.
### Generating code into build folder: D:\localhome\taol\Documents\MATLAB\untitled_cnp_rtw
Overflow occurred. This originated from 'untitled/ClutchOverloadDetection/Clutch Overload/IfAction_Subsystem/Friction Energy Calculation/IfAction/Add1'.
Component:Simulink | Category:BlockwarningSuppress this warning
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: D:\Programme\MATLAB\R2016b\rtw\c\canape\cnp.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
…………………………………………………………………….
…………………….
### Writing header file untitled.h
### Writing header file untitled_types.h
### Writing header file untitled_private.h
### Writing header file rtwtypes.h
.
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing header file zero_crossing_types.h
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### Writing header file rt_nonfinite.h
.
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing source file untitled.c
### Writing header file rtmodel.h
### Writing source file untitled_data.c
### Writing header file rt_defines.h
.
### TLC code generation complete.
### Generating TLC interface API.
### Creating ASAP2 file: untitled.a2l
Warning: Skipping non-reference parameter: BreakpointsData
### Indenting ASAP2 file.
.
### Processing Template Makefile: D:\Programme\MATLAB\R2016b\rtw\c\canape\cnp_msdll.tmf
### Creating untitled.mk from D:\Programme\MATLAB\R2016b\rtw\c\canape\cnp_msdll.tmf
### Building untitled: .\untitled.bat
D:\localhome\taol\Documents\MATLAB\untitled_cnp_rtw>call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\SetEnv" /x86 /release /xp 2>devnull.2 1>devnull.1
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
untitled.c
untitled.c(147) : warning C4013: 'trunc' undefined; assuming extern returning int
rtGetInf.c
rtGetNaN.c
rt_logging.c
rt_matrx.c
rt_nonfinite.c
rt_printf.c
untitled_data.c
cnp_main.c
xcpBasic.c
xcpServer.c
rt_sim.c
rtwlog.c
cnpcomm.cpp
nlapml.cpp
timer.cpp
cnpenvin.c
cnpenvout.c
### Linking …
Creating library Release/untitled.lib and object Release/untitled.exp
untitled.obj : error LNK2019: unresolved external symbol _trunc referenced in function _untitled_output
Release\untitled.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\link.EXE"' : return code '0x460'
Stop.
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
Error(s) encountered while building "untitled"
Best Answer