Building a Gen module that contains external references using MS Visual Studio 2010

Document ID : KB000020947
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

When building a Gen module that contains external references, and using MS Visual Studio 2010, you may experience the following error.

... 
...
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
C:\Models\<model_name>.ief\c\<reference>.DLL : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x460' Stop.
****************************
Link step for <reference>.DLL using C:\Models\<model_name>.ief\c\<reference>.LNK failed with errors.
...
...

Solution:

This is a known issue with Microsoft, reference the Microsoft link: http://support.microsoft.com/kb/148652

As a work around in Gen r8, you can add the entry: /NOD:LIBCMT.lib, to the OPT.IEFLINK key in the OPTIONS tab of the build tool Profile as follows:

OPT.IEFLINK = /NOD:LIBCMT.lib