This function seems to be included in windows.h but GCC sends me nafig with this function. The task is from uni, and it is necessary that the code works when compiling directly from the console.

#include <stdio.h> #include <windows.h> #include <conio.h> #include <string.h> void main() { short screenWidth = 192, screenHeight = 108, cs = 8; SMALL_RECT writeRegion = { 0, 0, 1, 1 }; HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); HWND hWindow = GetConsoleWindow(); CHAR_INFO *lpBuffer; SetConsoleWindowInfo(hStdOut, TRUE, &writeRegion); COORD bufferSize = { screenWidth, screenHeight }; SetConsoleScreenBufferSize(hStdOut, bufferSize); SetConsoleActiveScreenBuffer(hStdOut); CONSOLE_FONT_INFOEX fontInfo; } 

console output

  • What version of gcc / mingw runtime? MWRM at the i686-w64-mingw32-gcc-6.4.0 / mingw64-runtime-5.0.3 cross-country. - Fat-Zer
  • -> gcc -v -> blablabla ........ blablabla ...... gcc version 8.2.0 (MinGW.org GCC-8.2.0-3) - Vladimir hares

2 answers 2

The CONSOLE_FONT_INFOEX structure is only available starting with Windows Vista. Apparently, you have an earlier version of the SDK as a target. Try to include such lines before turning on windows.h:

 #define WINVER _WIN32_WINNT_VISTA #define _WIN32_WINNT _WIN32_WINNT_VISTA #include <SDKDDKVer.h> 

Read more about this here .

  • nothing changes, except for the fact that now, at the beginning, there are two revisions about redifine. Here is the 1st sc: 3: warning: "WINVER" redefined #define WINVER _WIN32_WINNT_VISTA In file included from c: \ mingw \ include \ w32api.h: 59, from c: \ mingw \ include_mingw.h: 73, from c: \ mingw \ include \ stdio.h: 56, from sc: 1: c: \ mingw \ include \ sdkddkver.h: 190: note: define WINVER _WIN32_WINNT - Vladimir Hares
  • @Vladimir hares, well, you all wrote the error message. Your compiler uses its sdkddkver.h , which specifies the target version of Windows NT. Of course, this will not work. Either somehow delete this file, or edit it. - freim pm
  • to know what else to edit there - vladimir hares
  • @ Vladimir zaytsev, comment out (and better wrap in # ifdefs) the definition of WINVER. - Fat-Zer
  • @ Fat-Zer, _WIN32_WINNT also be commented out. And it's easier to edit them to _WIN32_WINNT_VISTA , and throw out your definitions. Well, I think so, I did not even see this MinGW from afar. - freim

Most likely the outdated MinGW is used. You need to install something newer, for example MinGW-w64

  • in fairness, _WIN32_WINNT is still worth asking ... and the MinGW version is newer with fresh headers will also support everything ... - Fat-Zer