MATLAB Answers


Fatal Errors LNK1123 and U1077 Related to Windows C++ Compiler

Asked by Jacob
on 21 Mar 2014
Latest activity Commented on by Friedrich
on 1 Apr 2014

I'm trying to compile a simple model into a DLL file to run in a HIL simulation, and get an error during the process:

### Compiling the source Compile_Model_Example 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT -DNI_VERISTAND_MAINMODELFILE Compile_Model_Example.c 
### Compiling the model data file Compile_Model_Example_data 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT -DNI_VERISTAND_MODELDATAFILE Compile_Model_Example_data.c 
### Compiling rtGetInf.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rtGetInf.c 
### Compiling rtGetNaN.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rtGetNaN.c 
### Compiling C:\MATLAB_Install\MATLAB\R2011a\rtw\c\src\rt_logging.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT C:\MATLAB_Install\MATLAB\R2011a\rtw\c\src\rt_logging.c 
### Compiling rt_nonfinite.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rt_nonfinite.c 
### Compiling NIVeriStand_main.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT NIVeriStand_main.c 
### Compiling C:\MATLAB_Install\MATLAB\R2011a\rtw\c\src\rt_sim.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT C:\MATLAB_Install\MATLAB\R2011a\rtw\c\src\rt_sim.c 
### Compiling Compile_Model_Example.rc 
	rc Compile_Model_Example.rc 
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385  
Copyright (C) Microsoft Corporation.  All rights reserved.  
### Linking ... 
	C:\MATLAB_Install\MATLAB\R2011a\sys\perl\win32\bin\perl C:\MATLAB_Install\MATLAB\R2011a\rtw\c\tools\ Compile_Model_Example.lnk Compile_Model_Example.obj Compile_Model_Example_data.obj rtGetInf.obj rtGetNaN.obj rt_logging.obj rt_nonfinite.obj NIVeriStand_main.obj rt_sim.obj    Compile_Model_Example.res    
	link /RELEASE  /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll kernel32.lib advapi32.lib wsock32.lib     @Compile_Model_Example.lnk /dll -out:Compile_Model_Example.dll 
   Creating library Compile_Model_Example.lib and object Compile_Model_Example.exp 
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt 
NMAKE : fatal error U1077: 'C:\VisualExpress\VC\bin\link.EXE' : return code '0x463' 
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. 
### Build procedure for model: 'Compile_Model_Example' aborted due to an error.

Initially I had thought that the error was showing due to C++ Express being in the "C:\Program Files" file and did not like the space in the folder name. I uninstalled the compiler and reinstalled it into a new folder with a name that did not contain any spaces. After restarting MATLAB and running mex -setup (no issues finding the installed compiler), the error still shows when attempting to Build.

I've read that this version of compiler might be choking on .rc files, and the solution is to install a C++ 2010 Express Service Pack to correct it, but I'm not entirely sure if this is related to my issue. I can at least give it a try in the meantime. Any help is appreciated to solve this issue.


0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!