Menu

#185 basetyps.h inclusion

closed-fixed
gcc (462)
2002-10-14
2002-09-15
No

Hi,
I had problems with some sources (openvrml for
instance) that use "interface" as a variable name. The
problem is that there is a "#define interface struct" in
basetyps.h. When including <algorithm>, it ends up in
including basetyps.h

/mingw/include/c++/3.2/algorithm:66,
/mingw/include/c++/3.2/bits/stl_algobase.h:70,
/mingw/include/c++/3.2/iosfwd:46,
/mingw/include/c++/3.2/bits/fpos.h:44,
/mingw/include/c++/3.2/mingw32/bits/c++io.h:37,
/mingw/include/c++/3.2/mingw32/bits/gthr.h:98,
/mingw/include/c++/3.2/mingw32/bits/gthr-default.h:462,
/mingw/include/windows.h:50,
/mingw/include/basetyps.h:25 -> #define interface

I know that it is easy to rename all of the occurences of
interface with another name (that's what I did) but I think
that windows.h should not include basetyps.h

The windows.h from Visual C++ doesn't, so why
MinGW's should ?

With Visual C++ you get the "#define interface struct" if
you include "ole2.h" that includes "objbase.h" that does
the define.

"interface" isn't a c++ keyword so, unless you want to
do some COM stuff (that's where including ole2.h is
required), it should be allowed to use it as a variable
name, even when including <algorithm>.

The problem may occur with many programs from the
open source community.

Thanks.

Discussion

  • Julien Lunardelli

    • priority: 5 --> 3
     
  • Danny Smith

    Danny Smith - 2002-09-15

    Logged In: YES
    user_id=11494

    Try adding -D__GTHREAD_HIDE_WIN32API to command
    line. That should fix the problem unless you actually
    want to include <windows.h> in your C++ code.

    I'll look at moving '#define interface struct' out of
    basetyps.h but I suspect it will cause a lot of fallout
    with other headers. Maybe not.

    Danny

     
  • Danny Smith

    Danny Smith - 2002-09-15
    • priority: 3 --> 5
     
  • Julien Lunardelli

    Logged In: YES
    user_id=611305

    It worked.

    Thanks !

     
  • Danny Smith

    Danny Smith - 2002-10-14

    Logged In: YES
    user_id=11494

    I've removed inclusion of basetyps.h from windows.h
    and added it to objfwd.h. It may have to go in other
    headers as well, but since objbase.h already includes
    basetyps.h there shouldn't be fallout.

    This means that all the com object stuff is no longer
    exposed with WIN32_LEAN_AND_MEAN defined.

    Danny

     
  • Danny Smith

    Danny Smith - 2002-10-14
    • status: open --> closed-fixed