problems compiling mfc with winelib

Francois Gouget fgouget at free.fr
Thu Mar 22 13:52:18 CST 2001


On 21 Mar 2001, Doug Alcorn wrote:
[...]
> So, my
> assumption based on reading winehq.com is that I need to compile the
> mfc using winelib.

   Correct.


> I got all the code over to my linux box and converted all the
> files/directories to lowercase only.

   winemaker can do that for you.

[...]
> I had to define both CFLAGS and CPPFLAGS "-D_WIN32 -DWIN32 -D_WINDOWS
> -D_MBSC" in the environment.  Here's my configure line:
> 
> $ ./configure --with-win=/path/to/wine/sources
> --with-atl-includes=/path/to/atl/includes
> --with-mfc-includes=/path/to/parent/of/mfc/includes

   '--with-atl-includes' and '--with-mfc-includes' are only necessary
when compiling an MFC application, not the MFC themselves. They are used
to specify where to find the MFC includes. But since you're compiling
the MFC you already know where they are: it's coded into your
Makefile.in.


> It goes allong pretty well until it checks for afx.h. That's when it
> bombs majorly.

    Yes. I guess you let winemaker do its stuff and it guessed that the
MFC sources are MFC-based because of the stdafx.h file. But they are
obviously not :-)! I suggest you rerun winemaker in interactive mode
'winemaker --interactive .' and specify --nomfc in the mfc/src directory
(and the atl/src directory if you're going to really use it which you
may very well not). This will also give you a chance to specify the
exact include path for each directory.


> I get pages and pages of compile time errors in the
> config.log.  Lots of parse errors, syntax errors, scoping errors,
> redifinitions... lots of stuff.

    Once you get past the configure step above, which should be simple
once you've done the above, you'll be able to take care of these. It
will take some time, see my recent post in the newsgroup (titled 'Re:
winelib + MFC').


> Am I right that I have to compile mfc? 

   Yes, you have to. There's at least two good reasons for this:
 - winebuild cannot yet import dlls directly, but even if it could, it
would not work with C++ dlls because VC++ and g++ use different binary
layouts for classes, virtual tables, name mangling, etc.
 - the headers don't compile as is. So you'll have to modify them before
you can use them anyway.


> Is this something that most
> developers using winelib to compile windows programs do? 

   I don't really know. I guess if you have a large application it
would be much more work to get rid of the MFC than to compile the MFC
with Winelib. You may also end up having to support two versions unless
you go for a cross-platform toolkit.


> Are there instructions for doing so?

   Not much. See my post to the newsgroup.


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  In a world without fences who needs Gates?





More information about the wine-devel mailing list