Class member functions confused as Macros

Discussion in 'C++' started by cweisbrod@cogeco.ca, Nov 7, 2006.

  1. Guest

    Hi All,

    I realize I may be posting to the wrong group, but I can't help but
    think my problem is more related to C++ than Microsoft's particular C++
    compiler.

    I've been migrating a large project from CodeWarrior to Visual Studio
    and I'm having some difficulty with the Microsoft compiler.

    Here's the basic problem with simplified code:

    class A
    {
    public:
    bool IsMinimized(void);
    };

    bool A::IsMinimized(void)
    {
    return true;
    }

    int main()
    {
    A* theWindow = new A;
    theWindow->IsMinimized(); // Problem here
    delete theWindow;

    return 0;
    }

    The problem is that the compiler has already encountered a macro
    definition, as in:

    #define IsMinimized(x) IsIconic(x)

    And the compiler is warning me that my call to IsMinimized() "does not
    have enough actual parameters for macro 'IsMinimized'."

    Is there some way to resolve this issue short of renaming my class
    member functions?

    Thanks for any input.

    Clint Weisbrod.
     
    , Nov 7, 2006
    #1
    1. Advertising

  2. mlimber Guest

    wrote:
    > I realize I may be posting to the wrong group, but I can't help but
    > think my problem is more related to C++ than Microsoft's particular C++
    > compiler.
    >
    > I've been migrating a large project from CodeWarrior to Visual Studio
    > and I'm having some difficulty with the Microsoft compiler.
    >
    > Here's the basic problem with simplified code:
    >
    > class A
    > {
    > public:
    > bool IsMinimized(void);


    Abomination! (See
    <http://groups.google.com/group/comp.lang.c++/msg/895f1f98c4488dda>.)

    > };
    >
    > bool A::IsMinimized(void)
    > {
    > return true;
    > }
    >
    > int main()
    > {
    > A* theWindow = new A;
    > theWindow->IsMinimized(); // Problem here
    > delete theWindow;
    >
    > return 0;
    > }
    >
    > The problem is that the compiler has already encountered a macro
    > definition, as in:
    >
    > #define IsMinimized(x) IsIconic(x)
    >
    > And the compiler is warning me that my call to IsMinimized() "does not
    > have enough actual parameters for macro 'IsMinimized'."
    >
    > Is there some way to resolve this issue short of renaming my class
    > member functions?


    It's not related to Microsoft's compiler so much as their header files.
    Don't include the offender (which you might be able to do if you skip
    their all-inclusive stdafx.h-type construct) or #undef IsMinimized.

    Cheers! --M
     
    mlimber, Nov 7, 2006
    #2
    1. Advertising

  3. cweisbrod:

    > Is there some way to resolve this issue short of renaming my class
    > member functions?


    Microsoft is a pack of retards -- you just have to get used to this sort of
    tripe from them.

    --

    Frederick Gotham
     
    Frederick gotham, Nov 7, 2006
    #3
  4. wrote:
    > ...
    > Is there some way to resolve this issue short of renaming my class
    > member functions?
    > ...


    Do an '#undef IsMinimized' right after including the offending header file.

    --
    Best regards,
    Andrey Tarasevich
     
    Andrey Tarasevich, Nov 7, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    80
    Views:
    2,492
    Stephen J. Bevan
    Nov 7, 2003
  2. Replies:
    1
    Views:
    476
    Marco Antoniotti
    Oct 7, 2003
  3. Replies:
    5
    Views:
    511
  4. Hicham Mouline
    Replies:
    0
    Views:
    450
    Hicham Mouline
    Apr 23, 2009
  5. Hicham Mouline
    Replies:
    1
    Views:
    436
    Michael DOUBEZ
    Apr 24, 2009
Loading...

Share This Page