Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 753
  • Last Modified:

MFC C++: When application runs, Error: Ordinal #### not found in mfc42.dll

I get an error along the lines of: Error: Ordinal #### not found in mfc42.dll

The application is very large, I didn't produce it myself (only compiled it)

What are the possible issues that can cause this error?

What should I try to fix it?

Thanks!
0
oxygen_728
Asked:
oxygen_728
  • 10
  • 8
  • 4
2 Solutions
 
oxygen_728Author Commented:
Actually, I'm getting the error in MFCO42D.dll  

0
 
jkrCommented:
This behavior can occur if an outdated version of the DLL is installed on the computer.

>>What should I try to fix it?

What compiler did yo use? If it is VC6, you might want to install the Service Pack available at http://msdn2.microsoft.com/en-us/vstudio/aa718364.aspx
0
 
oxygen_728Author Commented:
I'm confused here... because I did use VC6 with service pack 6. I also installed the november 2001 SDK.

The source code was intended to be compiled with service pack 5 w/ the november 2001 SDK.

Are these ordinals set at compile time? Or are they specified in the source code?

Thanks for your time
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jkrCommented:
These ordinals are usually set a link time. When you build a release version, do you also get that error? Which ordinal is it actually? And what does the DependencyWalker (www.dependencawalker.com) report?
0
 
oxygen_728Author Commented:
I think the following output may be significant

I'm guessing that the linker version, and product version, and OS version all have to be the same or something? They are different on MFC042D.DLL

Also, the 4 results that I pasted below are marked in red (I think that means errors) for dependency walker.

The headers to the following values are:
Module        File Time Stamp    Link Time Stamp    File Size  Attr.  Link Checksum  Real Checksum  CPU  Subsystem  Symbols  Preferred Base  Actual Base  Virtual Size  Load Order  File Ver         Product Ver      Image Ver  Linker Ver  OS Ver  Subsystem Ver



[   ]  ADVAPI32.DLL  08/04/2004  1:56a  08/04/2004  2:56a    616,960  A      0x000A0DE4     0x000A0DE4     x86  Console    CV       0x77DD0000      Unknown      0x0009B000    Not Loaded  5.1.2600.2180    5.1.2600.2180    5.1        7.10        5.1     4.0
[   ]  MFCO42D.DLL   06/17/1998 12:00a  06/17/1998  8:45p    798,773  A      0x000C3BA9     0x000C3BA9     x86  GUI        PDB      0x5F500000      Unknown      0x000C5000    Not Loaded  6.0.8168.0       6.0.0.0          6.0        6.0         4.0     4.0
[   ]  SHLWAPI.DLL   10/23/2006 10:34a  10/23/2006 10:34a    474,112  A      0x000813EE     0x000813EE     x86  GUI        CV       0x77F60000      Unknown      0x00076000    Not Loaded  6.0.2900.3020    6.0.2900.3020    5.1        7.10        5.1     4.0
[   ]  USER32.DLL    03/08/2007 10:36a  03/08/2007 10:36a    577,536  A      0x000940E1     0x000940E1     x86  GUI        CV       0x7E410000      Unknown      0x00090000    Not Loaded  5.1.2600.3099    5.1.2600.3099    5.1        7.10        5.1     4.0
[D  ]  MPR.DLL       08/04/2004  1:56a  08/04/2004  2:56a     59,904  A      0x00018245     0x00018245     x86  Console    CV       0x71B20000      Unknown      0x00012000    Not Loaded  5.1.2600.2180    5.1.2600.2180    5.1        7.10        5.1     4.0
0
 
oxygen_728Author Commented:
Also, the error that is reported when the exe is run is: 3228

I'll be back at the computer in 1 hour or less

Thanks for your time
0
 
jkrCommented:
Hm, can you open "VC98\MFC\SRC\Intel\MFCO42D.DEF" and see if you can find the ordinal there?
0
 
oxygen_728Author Commented:
JKR, I'm not exactly sure what to look for, but here's the last items in the .DEF file... I'd guess that the numbers at the end of each line are the ordinals?

 ?WrapChanged@CRichEditView@@MAEXXZ @ 3160 NONAME
 ?Write@COleStreamFile@@UAEXPBXI@Z @ 3161 NONAME
 ?WriteItem@COleClientItem@@UAEXAAVCArchive@@@Z @ 3162 NONAME
 ?WriteItemCompound@COleClientItem@@QAEXAAVCArchive@@@Z @ 3163 NONAME
 ?WriteItemFlat@COleClientItem@@QAEXAAVCArchive@@@Z @ 3164 NONAME
 ?WriteNameDictToStream@CPropertySection@@QAEHPAUIStream@@@Z @ 3165 NONAME
 ?WriteToStream@CProperty@@QAEHPAUIStream@@@Z @ 3166 NONAME
 ?WriteToStream@CPropertySection@@QAEHPAUIStream@@@Z @ 3167 NONAME
 ?WriteToStream@CPropertySet@@QAEHPAUIStream@@@Z @ 3168 NONAME


There's nothing past that
0
 
oxygen_728Author Commented:
Well, I looked at the version of the file that comes with service pack 5, and it's nearly identical to the one that comes with service pack 6... neither have a 3228 in them.
0
 
jkrCommented:
The same here - that's why I asked in the 1st place. What about the release build, though?
0
 
oxygen_728Author Commented:
Well, I think I compiled it in both release mode and debug mode, and got the same result....

The problem is that there's around 30 solutions in the project... i dont know how to make sure everything is compiled in release vs. debug  (I'm a VC7 guy)

Any tips?

I'll have to get back to it in the morning to verify

0
 
oxygen_728Author Commented:
by "I'm a VC7 guy" i mean, I don't know how to achieve that in VC6
0
 
oxygen_728Author Commented:
JKR,

I got it to compile in release mode (and it runs too).

However, debug mode still doesn't work - it compiles but I get the same ordinal error.

Any last thoughts?

Thanks for your time
0
 
jkrCommented:
Can you do a

dumpbin.exe /imports yourapp.exe

?
0
 
itsmeandnobodyelseCommented:
>>>> (I'm a VC7 guy)
I would assume that you mixed up mfc42d.dll that came with another product than VC6. I mean to remember that there was a wrong mfc42d.dll which came with MS OFFICE.

To find out whether I am right, you should spot the mfc42d.dll in the system32 folder and look for properties. It should show file version 6.0.8665.0 or younger (but version 6). Make sure that there is no other mfc42d.dll somewhere in 'path'. You better check all disk(s) for that.

FYI: VC7 doesn't add a new mfc42(d).dll but made its own mfc enhancements into mfc71(d).dll.

Regards, Alex
0
 
jkrCommented:
>>I mean to remember that there was a wrong mfc42d.dll which came with MS
>>OFFICE.

No. MS does not ship Debug versions of their runtime. I have no doubt though that they would ship a mfc42.dll with MSO.
0
 
itsmeandnobodyelseCommented:
>>>> MS does not ship Debug versions of their runtime.
They do with MS ACCESS.
0
 
itsmeandnobodyelseCommented:
And sometimes OLE controls bring 'their' mfc42(d).dll with and install it regardless whether there is a younger version. mfc42.dll firstly comes with VC 4.2 and I installed at least 4 versions of it both Debug and Release.
0
 
jkrCommented:
Well, since you've read the thread, you will have noticed that the MFC DLLs that come with the installation with which the image in question was built don't export that ordinal in the 1st place nor even reference it in any module definition file. Thus I am inclined to think of a build problem instead, since the import reference for a not in any way defined function was created when linking.
0
 
itsmeandnobodyelseCommented:
>>>> Thus I am inclined to think of a build problem instead,
You may be right, though I definitively know that I already heard of the problem before. But I can't remember whether it was here in EE or when I developed MFC apps in the late nineties. Friends made development using MS Access and mfc42.dll was one that made problems. But you are maybe right that it was the release dll and not the debug dll.
0
 
oxygen_728Author Commented:
Thanks very much for your input... it is much appreciated
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now