VC++ 2005 compile error C2061

Started by
8 comments, last by Omid Ghavami 18 years, 3 months ago
The following lines get C2061 error "syntax error : identifier HWND" and the same for UINT class X protected: ... virtual int Init (HWND, const HWND, int, int, int, int) =0; ... virtual int UseWindow (UINT nHwnd) =0; Any ideas why? Those are the only macros in the prototypes and I don't get that error for the rest of the class. I get the same error in other classes but not for HINSTANCE. Thnx
Advertisement
it means he compiler doesn't know what an HWND is. check your order of incluseion, or to be just safe include windows.h right before your class.
That is what I thought at first too, but I noticed the error is "syntax error : identifier" not unknown identifier or whatever.

I did some research on MSDN and it says that it means that it is unexpected. Not that it is invalid or unknown, just unexpected. I tried their solutions but they are confusing and I couldn't get anything to work.
Adding windows.h gets rid of the problem but does this include MFC in my code too? On MSDN it says, not that MSDN has been much help to me, but it says windows.h just includes something like afx.h which is labeled as MFC.
Including windows.h fixes the problem because HWND and UINT are defined in a header file included by windows.h.

windows.h does not include any MFC headers.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Thanks with that, now I have a new problem. I think my problem is VS 2005 because I have never had these strange errors before. But here is the new one.


DWORD m_dwHeight; // Screen Height
FILE* m_pLog; // Log file


I get error C2143, missing ; before *


thanks
Did you include <cstdio>?
Why can't VS 2005 just say that FILE is undefined? I think it did in version 6.

Thanks for the help.


And sorry for the dumb questions, I have been programming in C on Unix machines for the past 6 months. Now I am coping C++ code from a book and I am having trouble remembering all the little things.
I feel really stupid, but do I need to link something for DirectX types.

The code on the book's cd includes <d3d9.h>, which apparetly can't be found when I compile.

I looked it up and the type is in <d3d9types.h>, which can't be found either.

So, anyone got an obvious solution to this one.

Thanks
Have you added d3d include directory to your include paths?

Hope this helps

Regards,
/Omid
Best regards, Omid

This topic is closed to new replies.

Advertisement