Building MFCMAPI With Visual Studio 6

Update – Get the latest MFCMAPI build and source (which should build with VS6) at

I’m still working on getting the MAPI Editor source public. In the meantime, one of my colleagues informed me that the MFCMAPI source ( doesn’t build with Visual Studio 6 anymore.

This was quite surprising since I build it all the time with VS 6. So we compared our machines to figure out why.

First issue – if you just install VC 6 and try to build the source the first thing you see is this:

c:\mfcmapi\res\MFCMapi.rc2(53) : error RC2188: #error :  "MFCMAPI requires that the February 2003 or later Microsoft SDK be installed for compilation"
c:\mfcmapi\res\MFCMapi.rc2(54) : error RC2188: #error :  "Go to the following URL"
c:\mfcmapi\res\MFCMapi.rc2(55) : error RC2188: #error :  ""
c:\mfcmapi\res\MFCMapi.rc2(56) : error RC2188: #error :  "and follow the instructions to install the core SDK"

Ok – that’s pretty straightforward. So you install that, but it still doesn’t work. Oh yeah – I left something out of my instructions:

Fix 1

In Visual C++, under Tools/Options/Directories, you need to add the Platform SDK to the Include and Library paths. The new entries will need to come before the existing Visual Studio Entries. So, supposing the SDK was installed to c:\Program Files\Microsoft Platform SDK, to Include you would add:

c:\Program Files\Microsoft Platform SDK\Include
c:\Program Files\Microsoft Platform SDK\Include\MFC
c:\Program Files\Microsoft Platform SDK\Include\ATL

and to Library you would add:

c:\Program Files\Microsoft Platform SDK\Lib 

So you do that and it mostly compiles. Well, except for this:

C:\mfcmapi\File.cpp(594) : error C2039: 'pwcsTemplateFile' : is not a member of 'tagSTGOPTIONS'
        C:\Program Files\Microsoft Platform SDK\Include\objbase.h(913) : see declaration of 'tagSTGOPTIONS'

Ok – this worked with the February 2003 SDK, but the SDK folks must have changed a header. No problem – we see that the line was redundant – we can get rid of it:

Fix 2

Cut this line from file.cpp:

myOpts.pwcsTemplateFile = 0;

Now we compile, but we still don’t link! We get this:

Linking… uuid.lib(cguid_i.obj) : fatal error LNK1103: debugging information corrupt; recompile module Error executing link.exe.

If you do some searches on this error, you’ll find a whole firestorm of debate on whether or not the SDK folks did the right thing with uuid.lib and discontinued support for VC 6. I won’t give my opinion, but for the purposes of getting the project to build, here’s one workaround:

Fix 3

Locate the platform SDK’s copy of uuid.lib here:

c:\program files\microsoft platform SDK\Lib 

and rename it to uuid.bak. Then locate the VC6 copy of uuid.lib here:

c:\program files\Microsoft Visual Studio\VC98\Lib 

and copy it into the above directory. Now everything should link.

If/when I get the MAPI Editor source published it will include a Visual Studio 2005 project, so hopefully this won’t be a problem in the future.

Comments (2)

  1. Clement Yip says:

    I got the same problem with uuid.lib link problem.  Thanks for your info.  Saved me a lot of time.

    I actually tried a different way to solve the uuid.lib link problem.

    On my VC6 Lib directory, instead of copy the uuid.lib out to replace the PSDK version, I make a copy of uuid.lib and name it uuid_vc6.lib.

    Then I modify my project file to link with uuid_vc6.lib.

    This worked for me.

    Now we have 2 different ways to solve this, depending on your need.

    The advantage of my approach is that I could have parallel compilation on same machine.  i.e. I can compile the same code both under VC6 and VC8 on the same machine.

    What do you think?

  2. Stephen Griffin says:

    I thought something like that might work but I was too lazy to test it. Thanks!