Why do I receive a linker error when building an xPC Target having with Microsoft Visual C++ 6.0 compiler in SimDriveline 1.3 (R2007a)?

1 view (last 30 days)
I cannot build an xPC target using SimDriveline and Microsoft Visual C++ 6.0. A linker error will occur similar to the one given below.
drive_vc.lib(drive_e4001db2.obj) : error LNK2001: unresolved external symbol __ftol2
MPC566_Motor_Control_xpc2.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The linker error is issued because the deployed SimDriveline libraries are compiled with Microsoft Visual Studio 7.0. Trying to link it using Visual C++ 6.0 causes the failure.
As a workaround, please modify the batch file ‘modename.bat' so that OPT_OPTS is defined. In order to perform the above please follow the steps below:
1. Build the model. When it tries to link the libraries you will receive an error. Please go to the generated 'modelname.bat' file in the 'modelaname_xpc_rtw' folder and open it for editing.
2. Locate the' nmake -f modelname.bak ' line and add the following to the end of this line:
OPT_OPTS= ADD_MDL_NAME_TO_GLOBALS=1 EXT_MODE=1 VISUAL_VER=6.0
3. Save the 'modelname.bat' file. Execute it manually by entering the following at the MATLAB command prompt:
! modelname &
4. The above steps will force the deployed SimDriveline libraries to be rebuilt with VC++ 6.0. The executable for xPC target should run without any problems.
However the recommended workaround is to upgrade and use the Visual Studio 7.0 compiler, which will allow you to generate an executable without any workaround steps.

More Answers (0)

Categories

Find more on Simscape Driveline in Help Center and File Exchange

Products


Release

R2007a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!