Link to home
Start Free TrialLog in
Avatar of oxygen_728
oxygen_728

asked on

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!
Avatar of oxygen_728
oxygen_728

ASKER

Actually, I'm getting the error in MFCO42D.dll  

Avatar of jkr
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
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
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?
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
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
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
The same here - that's why I asked in the 1st place. What about the release build, though?
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

by "I'm a VC7 guy" i mean, I don't know how to achieve that in VC6
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
Can you do a

dumpbin.exe /imports yourapp.exe

?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>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.
>>>> MS does not ship Debug versions of their runtime.
They do with MS ACCESS.
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.
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.
>>>> 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.
Thanks very much for your input... it is much appreciated