3 Replies - 309 Views - Last Post: 02 August 2014 - 01:41 PM Rate Topic: -----

#1 TheShak1ngHand  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-August 14

'SetConsoleDisplayMode' not declared in this scope

Posted 02 August 2014 - 12:21 PM

I am currently trying to compile and run a simple game written in c++.
I found the code here: http://cplus.about.c...utorial-One.htm

I get the following error while compiling:
error: 'CONSOLE_WINDOWED_MODE' was not declared in this scope
error: 'SetConsoleDisplayMode' was not declared in this scope

The relevant piece of code is:

COORD display::SetScreenSize(short x,short y) {
	COORD result;
	HANDLE hnd;
	result.X=0;
	result.Y=0;
    hnd= GetStdHandle(STD_OUTPUT_HANDLE) ;
    SetConsoleDisplayMode(hnd,CONSOLE_WINDOWED_MODE,&result);
    return result;
}


Does anybody know how to solve this?

Is This A Good Question/Topic? 0
  • +

Replies To: 'SetConsoleDisplayMode' not declared in this scope

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3623
  • View blog
  • Posts: 11,291
  • Joined: 05-May 12

Re: 'SetConsoleDisplayMode' not declared in this scope

Posted 02 August 2014 - 12:51 PM

Did you include windows.h?
What version of the Windows SDK do you have?
What value did you define the macro _WIN32_WINNT to be?
Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6079
  • View blog
  • Posts: 23,550
  • Joined: 23-August 08

Re: 'SetConsoleDisplayMode' not declared in this scope

Posted 02 August 2014 - 12:56 PM

What good is a 0 x 0 window???
Was This Post Helpful? 0
  • +
  • -

#4 TheShak1ngHand  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-August 14

Re: 'SetConsoleDisplayMode' not declared in this scope

Posted 02 August 2014 - 01:41 PM

View PostSkydiver, on 02 August 2014 - 12:51 PM, said:

Did you include windows.h?
What version of the Windows SDK do you have?
What value did you define the macro _WIN32_WINNT to be?


Thank you Skydiver. Turned out I needed to define _WIN32_WINNT in the following manner:

#define _WIN32_WINNT 0x0601

apparently before I include windows.h
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1