WIN95, VC++6.0, and the Wonder...
I installed VC++ onto a WIN95 box, (I got a lot of errors when it was trying to install) and, when i try to go and compile a WInMain project, it tells me all of these types (like HWND, WPARAM, LPARAM, etc..) don''t exist. I have #included the Windows.h file, so i was confused as to why i was getting these errors, until i realized that when it installed, it never copied over the Include directory.
So i copied the include directory over from the CD, and changed my directory settings in c++...
I am able to use the program now but I can only create console apps.. I #include(ed) iostream.h, and it works fine.
I tried the Microsft website, maybe download a service pack, but i can''t download anything for some reason.
So here is my quesiton: Is there anything i have to do to make it run smoothly on a WIN95 box, which is different from the norm?
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
What is it exactly that you''re having a problem with?
---visit #directxdev on afternet <- not just for directx, despite the name
Well, check it out.. here are the error messages i am getting:
error C2061: syntax error : identifier ''UNIT''
error C2065: ''msg'' : undeclared identifier
error C2065: ''wParam'' : undeclared identifier
error C2065: ''lParam'' : undeclared identifier
error C2065: ''MESSAGE'' : undeclared identifier
error C2146: syntax error : missing '';'' before identifier ''Msg''
error C2065: ''Msg'' : undeclared identifier
eerror C2065: ''GREY_BRUSH'' : undeclared identifier
error C2440: ''='' : cannot convert from ''long (__stdcall *)(struct HWND__ *)'' to ''long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)''
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
error C2440: ''='' : cannot convert from ''unsigned short'' to ''struct HWND__ *''
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
And here is the code:
I am confused because most of these "undeclared indetifiers" should be included in the windows.h, correct? any help would be cool, because i don''t know, and am confused. It works NP n my 2K box... damn windows 95!
error C2061: syntax error : identifier ''UNIT''
error C2065: ''msg'' : undeclared identifier
error C2065: ''wParam'' : undeclared identifier
error C2065: ''lParam'' : undeclared identifier
error C2065: ''MESSAGE'' : undeclared identifier
error C2146: syntax error : missing '';'' before identifier ''Msg''
error C2065: ''Msg'' : undeclared identifier
eerror C2065: ''GREY_BRUSH'' : undeclared identifier
error C2440: ''='' : cannot convert from ''long (__stdcall *)(struct HWND__ *)'' to ''long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)''
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
error C2440: ''='' : cannot convert from ''unsigned short'' to ''struct HWND__ *''
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
And here is the code:
#include <Windows.h>#define WIN32_LEAN_AND_MEANHWND ghWnd;char gAppName[] = "Hey Fuckers!";long CALLBACK WndProc(HWND hWnd, UNIT msg, WPARAM wParam, LPARAM lParam){ PAINTSTRUCT PaintStruct; HDC hDC; switch (msg) { case WM_CREATE: { return 0; } case WM_PAINT: { hDC = BeginPaint(ghWnd,&PaintStruct); EndPaint(ghWnd,&PaintStruct); return 0; } case WM_DESTROY: { PostQuitMessage(0); return 0; } default: { return DefWindowProc(ghWnd,msg,wParam,lParam); } } return 0;};int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ WNDCLASSEX wc; MESSAGE Msg; wc.cbClsExtra = NULL; wc.cbSize = sizeof(WNDCLASSEX); wc.cbWndExtra = NULL; wc.hbrBackground = (HBRUSH)GetStockObject(GREY_BRUSH); wc.hCursor = LoadCursor(hInstance,IDC_ARROW); wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION); wc.hIconSm = LoadIcon(hInstance,IDI_APPLICATION); wc.hInstance = hInstance; wc.lpfnWndProc = WndProc; wc.lpszClassName = gAppName; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; ghWnd = RegisterClassEx(&wc); ShowWindow(ghWnd,nCmdShow); UpdateWindow(ghWnd); while (GetMessage(&Msg,ghWnd,0,0)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } // TODO: Place code here. return Msg.wParam;}
I am confused because most of these "undeclared indetifiers" should be included in the windows.h, correct? any help would be cool, because i don''t know, and am confused. It works NP n my 2K box... damn windows 95!
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
Reinstall.
Also, #define''ing WIN32_LEAN_AND_MEAN after including windows.h has no effect.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Also, #define''ing WIN32_LEAN_AND_MEAN after including windows.h has no effect.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
i was looking through the windows.h file and it said something about win98 headers and NT headers.. do they have headers for 95?
thanx for the tip for WIN32_LEAN_AND_MEAN...
thanx for the tip for WIN32_LEAN_AND_MEAN...
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
Find out what WINVER is defined as by printing it:
%x prints a hexadecimal number.
~CGameProgrammer( );
printf( "WINVER: %x\n", WINVER );
%x prints a hexadecimal number.
~CGameProgrammer( );
~CGameProgrammer( );
Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Umm, I could be wrong, but since WndProc is being defined before the winmain, it is not prototyped, thus it should not have a semi-colon at the end of it. It is a function on its own.
Even though I have limited knowlege of the subject I''m pretty sure its more widely accepted to use LRESULT instead of long. and WINAPI instead of APIENTRY albiet they are the same its just more uniform to what other people do.
Also i know people have been talking about your lean define and how it doesnt help to define after inclusion of windows.h you also have it on the same line....
#include <Windows.h>#define WIN32_LEAN_AND_MEAN
should be..
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
once again.. i have limited experience but that''s my .02
enjoy.
Also i know people have been talking about your lean define and how it doesnt help to define after inclusion of windows.h you also have it on the same line....
#include <Windows.h>#define WIN32_LEAN_AND_MEAN
should be..
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
once again.. i have limited experience but that''s my .02
enjoy.
April 25, 2002 07:22 PM
LOL, nobody mentioned you should probably use a UINT instead of a UNIT. Since this is a gramatical error and an undefined type, anything following this will cause an error (hence undefined symbol msg, etc, etc). Try fixing this, and then let us know. I have no experience with Win95 and VC6, so I can''t help beyond that.
Billy - BillyB@mrsnj.com
Billy - BillyB@mrsnj.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement