Howto: loading old mfc code into visual studio express C++ 2010

dotnetguy37

Freshman
Joined
Nov 15, 2009
Please excuse if this procedure is documented elsewhere on the forum, but I didn't find it after doing some searching..

VisualStudio.Net C++ 2010 Express doesn't come with the MFC (Microsoft Foundation Class)
libraries and headers, per the chart on this MSDN Page:
http://msdn.microsoft.com/en-us/library/hs24szh9.aspx

I had some old VisualStudio.Net C++ Professional 32 bit code I needed to
load into the 2010 (using 32bit CLR) and build (that had MFC references).

So it's not a 32bit to 64 bit CLR upgrade, just 32 bit to 32 bit.
Note: I know even 32 bit CLR stuff involves wow64, per this MSDN entry:
http://msdn.microsoft.com/en-us/library/ms241064.aspx

Anyway, I found this article on how to do it (under 2008):
http://www.codeproject.com/Articles/...sual-C-Express

The article is wrong in two ways:
1.) The link for the DDK web page is wrong.
It should be for "1830_usa_ddk.iso".
It is the link called "download the ISO from Microsoft" under "Installing the DDK" section of this page:
http://www.tenouk.com/windowsddk/win...opmentkit.html
..or here is the direct link.
2.) The other change --under VS.Net C++ 2010 the setting of the VC directories has changed.
This article covers these changes:
http://blog.gockelhut.com/2009/11/vi...heets-and.html

They don't mention in the above blog article but if the Tools menu -> Settings is set to "Basic" (the default)
you can't get to where you need to go.

To view the property manager in VCExpress, you can must choose Tools -> Setting -> Expert settings.
After that, you will can finaly get to the View menu -> Property Manager option.

I didn't need to add MFC to all my projects so I just went to
View -> Property Manager and expanded "Debug | Win32",
Select "Microsoft.Cpp.Win32.user", right click, and select "Properties".
Click on in "VC++ Directories" (see attached screenshot 1)

Then follow the other attached screenshots to add the winddk entries to the include and library directories.

The build error you get if you don't do this is:
1.) something like missing file afx_something.h (actually a whole bunch of .h, header files, that start with afx, but most can be found elsewhere on the internet).
2.) If you find and replace most of the missing mfc header (.h) files you end up getting some missing files: afxres.h and afxres.rc errors (these files can't be found at large on the internet, but can be found inside the Microsoft PSDK (platform server 2003 sdk) install)
3.) Once all header and res files are dumped in the
/program files(x86)/Microsoft Visual Studio 2010 10.0/VC/include/ folder
then you end up getting a linker error (usually for missing mfc42d.lib/mfc42d.dll) - at this point is where the procedure
outlined in this post is really needed..

Caveat: This uses the old mfc42d, not the mfc that comes with 2008 or 2010, but if you just have some old VC++.net 2005 mfc code that needs to be loaded into VC++ 2010 express, at least you can get it loaded and maybe remove the mfc references afterwards..

Yeah I know this all stupid, but it's not really documented all in one place and that's what it took for me to get
a good build in VC++.Net 2010 express.
Maybe it will save someone else a lot of grief.
 

Attachments

  • PropertyManger_DialogScreenshot1.jpg
    187.8 KB · Views: 36
  • PropertyManger_DialogScreenshot2.jpg
    159.8 KB · Views: 31
  • PropertyManger_DialogScreenshot3.jpg
    56 KB · Views: 32
  • PropertyManger_DialogScreenshot4.jpg
    54.5 KB · Views: 32
Top Bottom