Thread: Error???WTF

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    2

    Error???WTF

    OK im about to smash this compiler!!! I keep getting this error:

    [Warning] cast to pointer from integer of different size

    And its referring to this piece of code....Why?

    Code:
     DrawIcon(hDC, rand() % g_pGame->GetWidth(), rand() % g_pGame->GetHeight(),
          (HICON)(WORD)GetClassLong(hWindow, GCL_HICON));
    Im using Bloodsheds dev-c++ and windows xp!

    Could someone please help??

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Its giving you a warning because GetClassLong() returns a DWORD which you cast to a WORD. A DWORD is 32 bits, a WORD is 16 bits. So you are losing 16 bits out of the address

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    2
    OK Thank You VeryVeryVery much for that but I have one more very newbish question to ask!

    How do I fix it if the compiler error says something like:
    [Linker error] undefined reference to `GameInitialize(HINSTANCE__*)'

    And thanks agian to Thantos for helping me out with my other problem!

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    It means you probably don't have a prototype for or the function call/prototype/definition of the GameInitialize() function don't match.

Popular pages Recent additions subscribe to a feed