compiling MFC...Advil required? ;-)

Adam Boyle adam.boyle at avocent.com
Mon Jan 24 18:26:31 CST 2005


Hi All,

First, thanks to all for the excellent work on Wine.  I'm a Crossover
Office user, and I anxiously await each week's Wine Weekly Newsletter as
well to keep myself up with happenings in the Wine world.  You guys
truly rock.

But I digress.  Here's the real reason for my e-mail:

I need to port one of my company's MFC-based application to Linux.  My
first thought was to use Winelib.

I understand from everything that I've read that I need to recompile MFC
using Wine.  Easier said than done, though.  I've spent several hours
just trying to get everything setup correctly, and things are still not
compiling correctly.

First, some questions:
- My initial attempt at compiling MFC was on the MFC source code from
VS.NET 2003.  After not being able to get a satisfactory Makefile
configuration for compling that version of MFC, I figured that perhaps
VS98's version of MFC was more commonly recompiled by Wine developers,
so I'm currently trying to compile VC98's MFC.  Is there a preferred
version of MFC that I should be compiling, or are they all equally
difficult?  ;-)
- I have the following RPM packages installed on my Mandrake 10.1 OS:
libwine1-20040813-2mdk, winelib-0.3-1mdk, libwine1-devel-20040813-2mdk,
wine-20040813-2mdk.  I have also downloaded the latest wine source code
from 20050111.  As mentioned before, I also have Crossover Office
installed.  In your opinion, is there a more compatible or better set of
libraries to use when compiling?  Anybody compiled MFC using the
Mandrake packages before?  (FYI, wineg++ --version and winegcc --version
both report that they are g++/gcc (GCC) 3.4.1.
- Also, should I be using an older version of Wine's source code,
instead of the very recent 20050111 version that I've currently got on
my system?

I've read the Winelib documentation on compiling MFC and have combed
through the mailing list archives as much as possible to get to where
I'm currently at.  After running winemaker on the VC98 source code
directories and tweaking the resulting VC98/MFC/src/Makefile quite a
bit, I also put the following #defines at the top of
VC98/MFC/src/stdafx.h:

#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
#define _AFX_NO_ATL_SUPPORT

(That seems to be basically what the Winelib docs tell me to do.)

Anyway, here's the current output when I run 'make -f Makefile' in the
VC98/MFC/src directory:

wineg++ -c  -mno-cygwin -isystem -fpermissive -fms-extensions -fshort-
wchar -DWINE_UNICODE_NATIVE -DICOM_USE_COM_INTERFACE_ATTRIBUTE -I. -
I/home/ajboyle/wine-20050111/include/msvcrt -
I/home/ajboyle/wine-20050111/include -I../Include    -o afxabort.o
afxabort.cpp
In file included from stdafx.h:96,
                 from afxabort.cpp:11:
../Include/afxcom_.h: In constructor `CIP<_Interface, _IID>::CIP
(IUnknown*)':
../Include/afxcom_.h:357: error: there are no arguments to `GetIID' that
depend on a template parameter, so a declaration of `GetIID' must be
available
../Include/afxcom_.h:357: error: (if you use `-fpermissive', G++ will
accept your code, but allowing the use of an undeclared name is
deprecated)
../Include/afxcom_.h: In member function `CIP<_Interface, _IID>&
CIP<_Interface, _IID>::operator=(IUnknown*)':
../Include/afxcom_.h:379: error: there are no arguments to
`QueryInterface' that depend on a template parameter, so a declaration
of `QueryInterface' must be available
../Include/afxcom_.h: At global scope:
../Include/afxcom_.h:403: error: an explicit specialization must be
preceded by 'template <>'
In file included from stdafx.h:110,
                 from afxabort.cpp:11:
../Include/afxctl.h: In constructor
`COleControl::XEventConnPt::XEventConnPt()':
../Include/afxctl.h:1303: warning: invalid access to non-static data
member `COleControl::m_xEventConnPt' of NULL object
../Include/afxctl.h:1303: warning: (perhaps the `offsetof' macro was
used incorrectly)
../Include/afxctl.h: In constructor
`COleControl::XPropConnPt::XPropConnPt()':
../Include/afxctl.h:1310: warning: invalid access to non-static data
member `COleControl::m_xPropConnPt' of NULL object
../Include/afxctl.h:1310: warning: (perhaps the `offsetof' macro was
used incorrectly)
In file included from ../Include/afxpriv.h:758,
                 from stdafx.h:123,
                 from afxabort.cpp:11:
../Include/afxconv.h:62:21: atlconv.h: No such file or directory
In file included from stdafx.h:127,
                 from afxabort.cpp:11:
oleimpl2.h: At global scope:
oleimpl2.h:94: error: a class-key must be used when declaring a friend
In file included from /usr/lib/gcc/i586-mandrake-linux-
gnu/3.4.1/../../../../include/c++/3.4.1/backward/new.h:33,
                 from stdafx.h:161,
                 from afxabort.cpp:11:
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../../include/c+
+/3.4.1/backward/backward_warning.h:32:2: warning: #warning This file
includes at least one deprecated or antiquated header. Please consider
using one of the 32 headers found in section 17.4.1.2 of the C++
standard. Examples include substituting the <X> header for the <X.h>
header for C++ includes, or <iostream> instead of the deprecated header
<iostream.h>. To disable this warning use -Wno-deprecated.
winegcc: g++ failed.
make: *** [afxabort.o] Error 2

Funny how gcc is telling me to use -fpermissive, when I'm already using
it.  Anyway, that's probably a red herring.

If I can gain a clear understanding of the current steps needed to
successfully compile MFC, I'd be more than happy to contribute updated
'Compiling MFC' docs to the Winelib docs to help out future developers
that may be in a similar predicament as me.

Thanks in advance for any help you can give me.

Adam Boyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20050124/7bb23266/attachment.htm


More information about the wine-devel mailing list