-
Compile Error
:confused:
Code:
#include "console.h"
Console::Console()
{
hIn = GetStdHandle(STD_INPUT_HANDLE);
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
scrBufferSize.X = CONSOLE_WIDTH;
scrBufferSize.Y = CONSOLE_HEIGHT;
SetConsoleScreenBufferSize(hOut, scrBufferSize);
SetConsoleDisplayMode(hOut, CONSOLE_FULLSCREEN_MODE, scrBufferSize);
};
I am attempting to write a constructor for Windows console class, I have #included <windows.h> but Dev-C++ says this function SetConsoleDisplayMode is undeclared, as well as the CONSOLE_FULLSCREEN_MODE. Yes, they have been defined in wincon.h also. Can someone help me understand why the compiler can't see this function and named constant?
-
Quote:
#include "console.h"
What is this?
To solve your problem, say I have two source files: one for main, and another for this class constructor. I must #include "console.h" in my main() source file, but #include <windows.h> in console.h:
main.cpp:
Code:
#include "console.h"
int main () { ... // etc.
console.h
Code:
#include <windows.h>
-
you also need to define _WIN32_WINNT before windows.h because many of the console functions depend on it. I think you need to be using either W2K or XP. If you are using Win95/98 those functions may not be available on your os.
Code:
#define _WIN32_WINNT 0x500
#include <windows.h>