Wine HQ

  WineHQ Menu
  WineHQ
  AppDB
  Bugzilla
  Wine Wiki
  Wine Forums
  About
  Introduction
  Features
  Screenshots
  Contributing
  News Blog
  World Wine News
  Press
  License
  Download
  Get Wine Now
  Support
  Getting Help
  FAQ
  Documentation
  HowTo
  Live Support Chat
  Paid Support
  Development
  Developers Guide
  Mailing Lists
  GIT
  Sending Patches
  To Do Lists
  Fun Projects
  Janitorial
  Winelib
  Status
  Resources
  WineConf
  Languages
English English
Español Español
  Search WineHQ

Compiling the MFC

4.3. Compiling the MFC

Here is a set of recommendations for getting the MFC compiled with WineLib:

We recommend running winemaker in '--interactive' mode to specify the right options for the MFC and the ATL part (to get the include paths right, to not consider the MFC MFC-based, and to get it to build libraries, not executables).

Then when compiling it you will indeed need a number of _AFX_NO_XXX macros. But this is not enough and there are other things you will need to '#ifdef-out'. For instance Wine's richedit support is not very good. Here are the AFX options I use:

#define _AFX_PORTABLE
#define _FORCENAMELESSUNION
#define _AFX_NO_DAO_SUPPORT
#define _AFX_NO_DHTML_SUPPORT
#define _AFX_NO_OLEDB_SUPPORT
#define _AFX_NO_RICHEDIT_SUPPORT
        

You will also need custom ones for CMonikerFile, OleDB, HtmlView, ...

We recommend using Wine's msvcrt headers (-isystem $(WINE_INCLUDE_ROOT)/msvcrt), though it means you will have to temporarily disable winsock support (#ifdef it out in windows.h).

You should use g++ compiler more recent than g++ 2.95. g++ 2.95 does not support unnamed structs while the more recent ones do, and this helps a lot. Here are the options worth mentioning:

  • -fms-extensions (helps get more code to compile)

  • -fshort-wchar -DWINE_UNICODE_NATIVE (helps with Unicode support)

  • -DICOM_USE_COM_INTERFACE_ATTRIBUTE (to get the COM code to work)

When you first reach the link stage you will get a lot of undefined symbol errors. To fix these you will need to go back to the source and #ifdef-out more code until you reach a 'closure'. There are also some files that don't need to be compiled.

Maybe we will have ready-made makefile here someday...