Windows 11 + GCC Compiler 17 (MINGW2)
gcc -o main.exe main.c -lncursesw ; ./main.exe
C:\msys64\mingw64\include
C:\msys64\mingw64\include\ncurses
C:\msys64\mingw64\include\ncursesw
It simply draws a border around the window.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ncurses/curses.h>
#include <wchar.h>
int main()
{
initscr();
int row = 0;
int col = 0;
getmaxyx(stdscr, row, col);
wchar_t * square = L"\u2588";
for (int i = 0; i < row; i++)
{
if (i == 0 || i == row - 1)
{
for (int j = 0; j < col; j++)
{
mvaddwstr(i, j, square);
}
}
else
{
mvaddwstr(i, 0, square);
mvaddwstr(i, col - 1, square);
}
}
refresh();
getch();
endwin();
return 0;
}
The compiler seems to believe that mvaddwstr
is implicitly declared. However, I have explicitly linked the ncursesw
library in the compilation command (as opposed to the regular ncurses
).
main.c:76:17: warning: implicit declaration of function 'mvaddwstr'; did you mean 'mvaddstr'? [-Wimplicit-function-declaration]
76 | mvaddwstr(i, j, square);
| ^~~~~~~~~
| mvaddstr
Despite the warning, the program works fine. However, I would like to resolve the warning nonetheless.
I have tried to include the curses.h
file from ncursesw
in the code. However, the warning persists.
#include <ncursesw/curses.h>
I have also tried adding an include to the ncursesw
directory in the compilation command, but the warning persists.
gcc -o main.exe main.c -IC:\msys64\mingw64\include\ncurseswncursesw -lncursesw; ./main.exe
As outlined in this solution, I simply had to enable wide character support with NCURSES_WIDECHAR
.
gcc -o main.exe main.c -DNCURSES_WIDECHAR=1 -lncursesw ; ./main.exe