| Zapeth (79) | |||||||||
|
Hello, first of all let me say that I do know that it's not possible to undefine a typedef as I already did a search in that direction. Now to my problem: I have a rather old application (not programmed by myself) which uses precompiled headers, the MFC libary and DirectX 6 (with the d3drm libary). These are the contents of stdafx.h:
then appincludes.h includes the d3drm header files
The problem with that is that afxwin.h includes among other things d2dbasetypes.h which typedefs D3DCOLORVALUE
however this conflicts afterwards with the d3drm headers because those include d3dtypes.h which typedef again D3DCOLORVALUE:
and including the d3drm headers before including afxwin.h is impossible because he then cancels with the error fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> So I hope anybody can give me some help to solve this problem because I have no idea how to do it :-P | |||||||||
|
|
|||||||||
| guestgulkan (2916) | ||||||
As you say the
So it will only make that typedef if D3DCOLORVALUE_DEFINED is NOT defined - so see what happens if you do this: What happens if you do this:
It's worth a try | ||||||
|
Last edited on
|
||||||
| andywestken (1966) | |||||
|
As you know, you can't #undef a typedef. But you can use #undef is to reverse a #define, which is the trick I use in my second (main) suggestion below. Note that with my version VC++, 2008, the MFC headers don't include d2dbasetypes.h. So I couldn't repro your problem or check my "shunt" solution properly. #1 If you haven't done so already, check the MFC and Windows SDK headers to see it the include is protected by a #ifndef at some level, to see if d2dbasetypes.h can be excluded by #defining something? #2 Try to shunt the old definition out of the way
which should work along the lines of this toy program
#? Failing that, and cleverer ideas from elsewhere, you might need to hack one of the headers. :-( Andy | |||||
|
Last edited on
|
|||||
| Zapeth (79) | |
|
@guestgulkan: thanks but I already tried that and he failed because the d2dbasetypes.h afterwards continues to use the D3DCOLORVALUE @andywestken: you are right, actually I'm using Visual Studio 2010, perhaps it's simply too new? I'm downloading Visual Studio 2008 right now and see if the problem persists (and if it does I'll try your suggestion) Thanks again for the help ;) | |
|
|
|
| Aramil of Elixia (772) | |
| i havent read all of the posts so I dont know if this is incorrect, but you can #undef typedefs? i thought u could only do that to define macros? | |
|
|
|
| andywestken (1966) | |
|
@Aramil of Elixia Read the very first part of the very first post. | |
|
|
|
| modoran (1245) | ||
It it still worth to support that application ?
| ||
|
|
||
| Zapeth (79) | |
|
@modoran: considering that there is no compiled version of that application available I would say so. I mean I don't want to "keep it alive", I just want it running somewhere :-P @andywestken: alright, I got past that problem simply by using an older version of Visual Studio. now I'm facing other problems but these are rather offtopic here and I guess I can solve them myself, thanks ;-) | |
|
|
|