Arrrrgh C++ help

Miscellaneous Forums/General Discussion/Arrrrgh C++ help

// test2.cpp : Defines the entry point for the console application.
//

#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <stdout.h>
#include <stdio.h>
#include <iostream.h>
#include "stdafx.h"

using namespace std;

int main()
{
    INPUT* x;
   //x=new struct tagINPUT;
   //printf(sizeof(struct tagINPUT));
   printf("hello");
   return 0;
}


The piece of coe above keeps complaining INPUT is an undefined identifier - even though it is defined in winuser.h (pulled in with windows.h). Any ideas why it's not working appreciated.

Show me the declaration of INPUT in windows.h

Boiled-
typedef struct tagINPUT {
    DWORD   type;

    union
    {
        MOUSEINPUT      mi;
        KEYBDINPUT      ki;
        HARDWAREINPUT   hi;
    };
} INPUT, *PINPUT, FAR* LPINPUT;

That's from winuser.h, which is included by windows.h.

Funny thing is, if I hover with the mouse over INPUT in the code with the mouse, it says 'Typedef tagINPUT INPUT' - so it's picking something up.

Are you sure its not in a namespace?
Or inside an IFDEF that is not defined?
EDIT
I just checked, and _WIN32_WINNT is not defined on my machine, and for INPUT, it needs to be > 0x0400.
You could define it manually before the include like this:
#define _WIN32_WINNT 0x0500
This way it would work, but it really shouldn't be done this way. I don't know why this constant is not defined.
EDIT2
Wait a minute, you do define _WIN32_WINNT as 0x0501 :S
Don't know why it doesn't work then :/
This works perfectly fine on my machine:
#define _WIN32_WINNT 0x0501
#include <windows.h>
//#include <stdout.h>
#include <stdio.h>
#include <iostream>
//#include "stdafx.h"

using namespace std;

int main()
{
	INPUT* x;
	//x=new struct tagINPUT;
	//printf(sizeof(struct tagINPUT));
	printf("hello");
	return 0;
}


Yeah, check the namespace and the defines.

Right thanks folks... I've absolutely no idea why its not working for me. Thanks for confirming Gosse. U running XP SP2?

Windows XP Pro SP2
MS VS 2005.

Thanks again. Think I'm going to give up. Reckon something's screwy with my compiler.

Could some kind soul with a working C++ compiler tell me what the sizeof(INPUT) is with the above code?

sizeof( INPUT ) is 28.

Cheers Floyd hope i can return the favour some day.