User forums > General (but related to Code::Blocks)
Console Font Info
(1/1)
alizadeh.mehrzad:
Hi everyone
When I try to use "CONSOLE_FONT_INFOEX" command to change console font, I face a compile error: "CONSOLE_FONT_INFOEX was not declared in this scope." I included "windows.h" header.
--- Code: ---#include <windows.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<fstream>
#include <wincon.h>
using namespace std ;
int main()
{
system("chcp 65001");
CONSOLE_FONT_INFOEX cfi ;
cfi.cbSize = sizeof cfi;
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 20;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
wcscpy(cfi.FaceName, L"Lucida Console");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
printf("Hello, \u0444!\n");
return 0;
}
--- End code ---
I am using Code::Blocks 16 and Windows 10. Could anybody please advise?
BlueHazzard:
1) http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
2) you probably use mingw compiler and i think the standard mingw compiler does not have this defined properly: http://lists-archives.com/git/830441-mingw-compat-winansi-c-do-not-redefine-console_font_infoex.html
to solve this you can use mingw64 compiler or search a header where the structure is defined and copy it to your project (and look at the license) (for ex. https://msdn.microsoft.com/de-de/library/windows/desktop/ms682069(v=vs.85).aspx)
Navigation
[0] Message Index
Go to full version