FIX: You may receive "LNK2001" and "LNK1120" linker errors when you link a project that has MBCS symbols in Microsoft Visual C++ 2005 SP1

Article translations Article translations
Article ID: 957510 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

When you build a project that has multibyte character set (MBCS) symbols (function or variable names), you may receive linker errors that resemble the following:
error LNK2001: unresolved external symbol __"u-{Oe
fatal error LNK1120: 1 unresolved externals
This problem occurs if the following conditions are true:
  • You use the Link.exe tool from Microsoft Visual C++ 2005 Service Pack 1 (SP1).
  • The project contains object (.obj) files that are compiled with a version that is earlier than Visual C++ 2005 SP1. Or, the project contains object (.obj) files that are compiled with a third-party compiler.

CAUSE

Microsoft Visual C++ 2005 SP1 and later versions use UTF-8 symbols. Therefore, the Link.exe tool is updated to use UTF-8 symbols to appropriately support localized function and variable names. However, earlier versions of Visual C++ use ANSI symbols and do not support MBCS symbols.

RESOLUTION

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

You must have Visual Studio 2005 Service Pack 1 (SP1) installed to apply this hotfix.

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix provides an updated Visual C++ 2005 Link.exe tool. The updated Visual C++ 2005 Link.exe tool supports MBCS symbols for compilers which use ANSI symbol tables. This update adds a new command-line option named /ANSIEXPORTS to enable this support.

This version supersedes the Link.exe tool that is described in the following Microsoft Knowledge Base article:
923418 FIX: You cannot link a C++ object file that contains MBCS symbols in Visual C++ 2005

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

x86

Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
link.exe8.0.50727.3075731,45614-Oct-200805:10
link.exe8.0.50727.3075961,85614-Oct-200805:10
link.exe8.0.50727.30752,044,73614-Oct-200805:10
link.exe8.0.50727.3075731,45614-Oct-200805:10
link.exe8.0.50727.3075731,45614-Oct-200805:10
link.exe8.0.50727.3075731,45614-Oct-200805:10
link.exe8.0.50727.3075731,45614-Oct-200805:10
link.exe8.0.50727.3075731,45614-Oct-200805:10

IA-64

Collapse this tableExpand this table
File nameFile versionFile sizeDateTime
link.exe8.0.50727.30752,044,73614-Oct-200801:07

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

This hotfix is made to support a third-party compiler that still generates MCBS symbols. It addresses the mismatch in symbol formats by supporting ANSI symbols with the /ANSIEXPORTS switch. If you are experiencing this problem, please contact your compiler vendor to determine whether this fix is recommended.

After you install this fix, view the documentation of your compiler for instructions for how to set the /ANSIEXPORTS switch in the project build options.

This hotfix is not needed if you are using one of the Microsoft compilers, such as Visual C++ 2005 or Visual C++ 2008, because the compiler and the linker use the same symbol format. Support for the /ANSIEXPORTS switch is limited to this version of Link.exe and will not be supported in Visual C++ 2008 or in later versions.

Properties

Article ID: 957510 - Last Review: December 19, 2008 - Revision: 1.1
APPLIES TO
  • Microsoft Visual Studio 2005 Service Pack 1
Keywords: 
kbsurveynew kbhotfixserver kbexpertiseadvanced kbqfe KB957510

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com