BUG: Error: L2029: '__FPMATH':Unresolved external with /NOI

ID: Q132853

1.51 1.52 WINDOWS

The information in this article applies to:

SYMPTOMS

The following linker error is generated when building an AppWizard- generated application using either version 1.51 or 1.52 of Visual C++:

   <path>\mfc\lib\mfc250d.lib(afxdll.asm) : error L2029: '__FPMATH'
                                          : unresolved external

This error is generated only when using the /NOI linker option (distinguish letter case), and linking to MFC in a DLL while using version 1.51 or 1.52 of Visual C++.

CAUSE

There is a reference made in the afxdll.asm file to the function

'void _fpmath(void)' in uppercase ( _FPMATH ). Without the /NOI
option, the linker resolves the symbol '_FPMATH' to '_fpmath' which is the correct behavior. However, with the /NOI option (distinguish letter case), the linker searches for the symbol '_FPMATH' and not
'_fpmath' which causes an unresolved external.

RESOLUTION

The error can be resolved by defining a function 'void _FPMATH(void)' in the application, and calling the function _fpmath() from within this function.

The following sample code illustrates this workaround. It should only be used when using the /NOI link option and linking to MFC in a DLL.

Sample Code

Add the following code to any one of the source files (.CPP) included in your project:

/* Compile options needed:
   /NOI - Distinguish Letter Case
   link with the MFC DLL library (mfc250(d).lib)
*/ 
... extern "C" void _fpmath(void); ... extern "C" void _FPMATH(void) {
   _fpmath();
}

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional reference words: 1.51 1.52 2.51 2.52 KBCategory: KBSubcategory: MfcMisc

Keywords          : kbcode kberrmsg kb16bitonly kbnokeyword kbMFC kbVC 
Version           : 1.51 1.52
Platform          : WINDOWS

Last Reviewed: May 22, 1998