CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2003
    Posts
    14

    the most sarcastic error I've ever seen

    ok how can this be happenin' ???????

    i get this error:

    E:\Documents and Settings\Bassouma\Desktop\August\Game Console\Game ConsoleDlg.cpp(308) : error C2664: 'DoIt' : cannot convert parameter 1 from 'class CStatic' to 'class CStatic'


    how is it possible that the 2st CStatic can't be converted to the 2nd

    this is toooooo much :'(
    Pleased 2 Beat ya

  2. #2
    Join Date
    Oct 1999
    Location
    Missouri, USA
    Posts
    453
    wow. I haven't seen that before. Maybe you could post some of the relevant lines
    of your code. Until then, dunno.
    If you need an answer, don't forget to try this link:
    http://www.codeguru.com/forum/search.php?
    __________________

  3. #3
    Join Date
    Jan 2001
    Posts
    29
    That kind of error has happened to me before when I forgot to put a reference parameter in an operator declaration. Please post your code.

  4. #4
    Join Date
    Dec 2003
    Posts
    14
    ok here's the function call that makes the problem:

    DoIt(m_TTwo,SERIAL);

    m_TTwo is a picture control i have <it's type is Cstatic> & SERIAL is int

    the func declaration is void CGameConsoleDlg:oIt(CStatic X,int SERIAL)

    any ideas ???
    Pleased 2 Beat ya

  5. #5
    Join Date
    Jan 2004
    Location
    Earth
    Posts
    567
    Hi,

    A better choice might be to pass a pointer to the CStatic rather than declare a whole new CStatic. For example :

    Code:
    CGameConsoleDlg:DoIt(CStatic *X,int SERIAL)
    and then to call the function using the address-of operator:

    Code:
    DoIt(&m_TTwo,SERIAL);
    You'll obnviously need to change the member selection operator ( . to ->) in the function. This might not solve the problem you are having but it is something to consider and try.

  6. #6
    Join Date
    Dec 2003
    Posts
    14
    thx man it works
    Pleased 2 Beat ya

  7. #7
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150
    Or pass a reference to avoid passing NULL values:
    Code:
    CGameConsoleDlg:DoIt(CStatic &X,int SERIAL)
    Use:
    Code:
    DoIt(m_TTwo,SERIAL);
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  8. #8
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Quote Originally Posted by bassouma86
    how is it possible that the 2st CStatic can't be converted to the 2nd
    C2664...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured