I have a small apps with only about half a dozen dialogs. It was originally developed in MS-DevStudio. Our desire is to use the same code between MS-Windows and Linux/Unix using the winelib. This app is derived from CWinApp and uses mfc for all the widgets. I'm told it would take too much effort to redo the app without mfc (I'm not a windows programmer, and don't know much about all that). So, my assumption based on reading winehq.com is that I need to compile the mfc using winelib.
I got all the code over to my linux box and converted all the files/directories to lowercase only. I got the mfc, atl, and some other include directory that was under "Program Files/Visual Studio/VC98" (or something similar). I ran winemaker on the mfc directory and successfully got the configure script built. The problem is getting the make files built.
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
It goes allong pretty well until it checks for afx.h. That's when it bombs majorly. 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.
Am I right that I have to compile mfc? Is this something that most developers using winelib to compile windows programs do? Are there instructions for doing so? At this point I'm totally stumped. I'm not about to start debugging mfc. I'll re-write the app before I do that. What is the suggested course of action?
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@free.fr http://fgouget.free.fr/ In a world without fences who needs Gates?