2021年2月5日星期五

How to Compile Ncurses Program for Native Windows Use

I'm trying to compile a C program using Ncurses on Windows. I compiled it successfully using GCC and it works perfectly if I run it in Cygwin or MSYS2. However, if I try to run it in the Windows Command Prompt, I get this error:

Error opening terminal: xterm-256color.

Is it possible to compile it to run using the native Windows console? This is how I've been compiling it:

gcc -o PROGRAMNAME main.c -lncurses

I also have the Cygwin and Msys dlls for Ncurses copied into the directory of the compiled executable.

Update

So I figured out how to get the program to run. I deleted all the DLLs from the project folder and then added "C:\msys64\usr\bin" to my PATH environment variable. However, I would still like to know if there's a way to get this to work if I were to distribute it, since it's still relying on my installation of MSYS2.

Update 2

Gave up and just used pdcurses and it works fine.

https://stackoverflow.com/questions/66063363/how-to-compile-ncurses-program-for-native-windows-use February 05, 2021 at 08:32PM

没有评论:

发表评论