MFC/CRT build instructions tweaklets

by Michael S. Kaplan, published on 2006/04/15 19:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/04/15/577006.aspx


The other day I got some mail about the instructions for rebuilding the Microsoft Foundation Classes and the C Runtime with the MS Layer for Unicode:

Hi Michael, two things need to be tweaked in the (otherwise, delightfully clear) docs on rebuilding the CRT and MFC libs. For 7.1, the atl path for the location of atlmfc.mak is given as "vc7/atlmfc", when I found it in "/vc7/atlmfc/src".

And second, and much more important, is that when compiling the MFC portion, please specify that a new Command Prompt window should be used after compiling the CRT libs. I gather that the make process twiddles with a lot of the env vars, corrupting them for the MFC make, causing a bunch of C2220 errors. That cose me a better part of a day trying to track that down:

...while the CRT stuff worked just as expected, my recompile of the ATL threw some errors. Specifically, this is for the 7.1 libs. And I am getting the error:

D:\MSVC .Net\Vc7\atlmfc\src>nmake -f atlmfc.mak MFC libname=MFC71L

setting PLATFORM=INTEL

if not exist ..\lib\INTEL md ..\lib\INTEL

cd mfc

nmake / DEBUG=0 _OD_EXT= PLATFORM=INTEL

cl @C:\DOCUME~1\MSMITH~1.COR\LOCALS~1\Temp\nm6773.tmp

objcore.cpp

D:\MSVC .Net\Vc7\atlmfc\include\afxv_w32.h(134) : error C2220: warning treated as error - no object file generated

D:\MSVC .Net\Vc7\atlmfc\include\afxv_w32.h(134) : warning C4005: 'NOSERVICE' : macro redefinition

command-line arguments : see previous definition of 'NOSERVICE'

D:\MSVC .Net\Vc7\atlmfc\include\atldef.h(261) : warning C4005: 'WIN32_LEAN_AND_MEAN' : macro redefinition

command-line arguments : see previous definition of 'WIN32_LEAN_AND_MEAN'

I talked to the author if the instructions, and I did take care of that first part, the error in the path.

But he noticed that the second part was already covered in the instructions, for all four versions (6.0, 7.0, 7.1, and 8.0):

...as the CRT build defines some symbols that MFC build also uses, a user cannot build MFC in the same command prompt "session" as the CRT.  They must exit the command prompt and create a new command prompt session and then start the MFC build from that session.. 

Actually, come to think of it, we already mention this in the instructions: "The CRT build is now done.  Before proceeding any further we need to close the command prompt that we used to build the CRT because it created certain environment variables that will cause compile errors in the next step, building the Unicode version of MFC."

So if the user had followed those instructions they would have succeeded beyond their wildest dreams.   :)

I went ahead and made it RED in each set of instructions so that people would be able to feel embarrassed if they did not see it. :-)


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day