[GCC-XML] /MD switch in msvc71. Any MFC patch?

Brad King brad.king at kitware.com
Tue Sep 6 12:58:58 EDT 2005

László Blum wrote:
> Compiling my MFC application with gccxml I had to have the /MD
> (multithreaded DLL) flag with msvc71.
> How can I do it?
> The question sounds trivial and I tried it according to the doc.
> /MD" has no effect.

The GCCXML_CXXFLAGS are passed to the native compiler when it is 
executed to determine the set of preprocessor definitions it produces. 
Unfortunately the VS compiler does not seem to have a way to report all 
the preprocessor definitions in effect, so automatic determination does 
not work.  For this compiler the set of definitions was determined by 
hand by reading documentation and trial-and-error.  This means they do 
not change with the flags.

> For GCCXML_USER_FLAGS=" -MD" it complains for an extra filename after the

These flags are passed to the GCC parser used internally by GCC-XML so 
only valid GCC flags may be used.

You'll have to figure out what preprocessor macro definitions are 
changed by /MD and add them to GCCXML_USER_FLAGS as "-D..." options.

> I need the _AFXDLL define that requires the above switch.
> I included the MFC include path by hand.
> I got a plenty of errors like this:
> C:/Program Files/Microsoft Visual Studio .NET
> 2003/Vc7/atlmfc/include/atlalloc.h
> :218: error: syntax
>    error before `...' token
> I guess these are the parts I have to patch manually...
> Is there any patch for MFC files?

Many of the VS system headers get parse errors.  If you look near the 
gccxml executable you will see a Vc71 subdirectory containing patched 
copies of some headers.  This is where you need to place the fixed MFC 
headers.  Alternatively you can place the fixed headers in any directory 
(do not replace the original system header) and use the special 
"-iwrapper" option in GCCXML_USER_FLAGS to specify the directory as a 
place to look for "wrapper" headers.


More information about the gccxml mailing list