fun with _VARIANT_BOOL and __unaligned

This is a discussion on fun with _VARIANT_BOOL and __unaligned within the Windows Programming forums, part of the Platform Specific Boards category; This is related to my previous post: "Dev C++ linker error: undefined reference" But I have progressed past those symptoms ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    17

    Unhappy fun with _VARIANT_BOOL and __unaligned

    This is related to my previous post:
    "Dev C++ linker error: undefined reference"
    But I have progressed past those symptoms and figured I should start a new thread.

    I have imported an MSVC TextEditor project named NoteXPad2 into Dev-C++. Compiling the thing has tunred out to be a real pain in the butt. I just updated all of my header files using microsofts Platform SDK update. This completely changed the set of errors I am seeing. So....

    90 percent of the errors seem to trace back to two issues:

    The first one begins with a warning:
    C:\Dev-Cpp\include\oaidl.h:442
    [Warning] pasting "/" and "/" does not give a valid preprocessing token

    NOTE: oaidl.h is not one of my files. This is a header file.

    Line 442 of oaidl.h is just
    _VARIANT_BOOL bool;

    _VARIANT_BOOL is defined in wtypes.h as:
    #if !__STDC__ && (_MSC_VER <= 1000)
    /* For backward compatibility */
    typedef VARIANT_BOOL _VARIANT_BOOL;
    #else
    /* ANSI C/C++ reserve bool as keyword */
    #define _VARIANT_BOOL /##/
    #endif

    Im not sure what my _MSC_VER is. Im on Win2k pro.
    Obviously its hitting the slashes in the else statement and not liking it. This is only a warning but it leads to

    442 C:\Dev-Cpp\include\oaidl.h
    parse error before `/' token

    at the point _VARIANT_BOOL is actually used. Again, the line in question is simply:
    _VARIANT_BOOL bool;
    so the bad '/' token HAS to come from the #define _VARIANT_BOOL /##/.


    The second problem source is much easier to explain:

    Every parse error (and there are a lot) that is not explained by the above, just happens to have __unaligned before it.

    __unaligned is defined in ShTypes.h:

    #if defined(_M_IX86)
    #define __unaligned
    #endif // __unaligned

    But I can find nowhere that _M_IX86 is defined. (Ive done a search of my entire hard drive and found nothing)
    Nowhere in my errors does it actually state "__unaligned undeclared" or anything of that nature, but everywhere __unaligned is used it is followed by a parse error.
    I cant believe its coincidence.

    So ive traced it all back to two damned lines of code, and I STILL cant figure it out!!!!! ARGH!!

    Any help would be greatly appreciated.

    -Josh

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,648
    >> I just updated all of my header files using microsofts Platform SDK update.

    I don't think that's compatible with MinGW.

    gg

  3. #3
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293
    Correct, you'll have to port it if you can.

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    17

    Thumbs up

    Wow, this was a HUGE learning experience for me. I finnaly got it to compile. My thanks to the many folks who helped out.

    In the end it came down to something relatively simple. _WIN32_IE is not getting set correctly, so a ton of defines were not being parsed. This led me down all the wrong paths trying to correct it.

    In the end I had to do a manual
    #define _WIN32_IE 0x0500

    Can anyone tell me where this is supposed to get set? Is this something I should have known to manualy set?

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,648
    Usually, I have to set stuff like that manually myself - using VC++ 6.0 even.

    gg

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21