Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:32:03+00:00 2026-06-08T09:32:03+00:00

I am trying to compile a program I wrote a few years ago that

  • 0

I am trying to compile a program I wrote a few years ago that simulates mouse clicks and key strokes. I’ve reduced it to this minimal example:

#include "Windows.h"

int main(){
    INPUT foo;
    return 0;
}

It gives me this error:

C:\projects\clicker>g++ minimaltest.cpp
minimaltest.cpp: In function 'int main()':
minimaltest.cpp:4:2: error: 'INPUT' was not declared in this scope
minimaltest.cpp:4:8: error: expected ';' before 'foo'

MSDN’s page on INPUT says it’s defined in Windows.h, so I don’t know why it doesn’t recognize the type.

Another stackoverflow user had a similar problem here, but their solution, adding #define _WIN32_WINNT 0x0500, didn’t fix the errors.

I was able to build the program years ago on windows XP. Could it be that INPUT doesn’t work on Windows 7 the way it did on XP? Or maybe I forgot to supply a flag to the compiler?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:32:05+00:00Added an answer on June 8, 2026 at 9:32 am

    You’ve misplaced your #define to after the #include. The result of this is that windows.h sees _WIN32_WINNT as undefined, so INPUT is not declared. Then you define it after INPUT‘s chance of existing has passed.

    #define _WIN32_WINNT 0x0500 //RIGHT
    #include "Windows.h"
    #define _WIN32_WINNT 0x0500 //WRONG
    
    int main(){
        INPUT foo;
        return 0;
    }
    

    As a side note, unless windows.h is in the same directory as the source file, it should typically be imported using #include <> rather than #include "".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compile a c++ program that i wrote myself. And I'm having
I have a python program I wrote that I am trying to compile with
I'm trying to convert an old Delphi program I wrote into Java to compile
I'm trying to compile an example program that links to the shared library produced
when I'm trying to compile my c program it gives me this error warning:
I'm trying to compile this simple program to start learning how to use timers:
I'm trying to compile the tetris program I wrote with C++ and SDL on
I am trying to compile a C program through a javacode. I did it
I am trying to compile my C program in Ubuntu 9.10 (gcc 4.4.1). I
I'm trying to compile the following program: #include<functional> #include<iostream> int main(int argc, char* argv[],

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.