Use ncursesw6 on mingw
That looks as if you downloaded one of the sample cross-compiled builds from the ncurses homepage. Those are configured assuming a typical MinGW configuration, with the DLLs in /bin
, the headers under /include
and the link-libraries in /lib
.
It is possible to use that from another location, but you would have to modify the ncursesw6-config
script to reflect the new location. Also, the DLLs have to be in some directory on your $PATH
. If they are not, that may not interfere with linking, but will prevent the resulting programs from running.
In the script, there is a section like this:
prefix=""
exec_prefix="${prefix}"
bindir="${exec_prefix}/bin"
includedir="${prefix}/include"
libdir="${exec_prefix}/lib"
datarootdir="${prefix}/share"
datadir="${datarootdir}"
mandir="${datarootdir}/man"
Based on the illustration of your directory tree, you would want to change that first line to
prefix=/home/LNV/ncurses6_mingw64
and add
/home/LNV/ncurses6_mingw64/bin
to your PATH
environment variable.
By the way, MinGW has a package for ncurses, which you might consider using...
Where do I put the -lncurses to properly link the ncurses library
Apple's bundled copy of ncurses (5.7) is configured for wide-character ncurses. For that platform (and perhaps a few others), the makefile could just use -lncurses
.
But waddwnstr uses wchar_t
parameters, which makes it a wide-character function. For the usual case, that is in the wide-character library, so you would use -lncursesw
.
If you were using an add-on library (i.e., MacPorts or brew), that uses a symbolic link to allow either name to be used, to simplify porting.
Keeping things like this straight is generally done with configure scripts (to produce a correct makefile), so that your makefile would contain
LDFLAGS = -lncurses -lstdc++fs
or
LDFLAGS = -lncursesw -lstdc++fs
If both libraries were specified, the linker should complain about the duplicated symbols between the two libraries -- for most platforms other than MacOS.
When both libraries are available, the header files also are available, requiring some compiler (-I) options and/or source-modification to use the correct header (not just ncurses.h
). Again, a configure script is the usual approach.
Add curses library to Visual Studio C++?
In a nutshell: you want Bill Gray's PDCurses. That fork is quite active. The "original" implementation is in
Bill McBrine's repo, with some activity going on. The two projects seem sadly to have diverged, though. The former has implemented a native Win32a GDI terminal window, while the latter only supports the native Windows console.
What you did is not how to use curses at all. What you have downloaded is source code, there are no binaries there at all - no .lib nor .dll files for any architecture. Not only that, but the source code can't be directly compiled either -- if you'd have added it to a C/C++ project, even on a Unix box, it wouldn't compile.
In order to compile, curses needs to have a configure
script run, that generates some files, probably config.h
, perhaps other source files, and makefiles.
Alas, all that is a moot point because curses is AFAIK a Unix library that really depends on Unix APIs being present. Any Windows ports are completely separate efforts.
See also Is ncurses available for windows?.
Install Haskell terminfo in Windows
So I tried cabal install terminfo --extra-lib-dirs=/lib/ncursesw
, but then I realized that cabal is a windows app, so I've also tried --extra-lib-dirs=c:/cygwin/lib/ncursesw
In the end, final solution is as follows:
- Install Cygwin and
ncursesw-devel
package there - Run cygwin and configure GCC:
$ export C_INCLUDE_PATH=/usr/include/ncursesw
- Since
C:\cygwin\usr\include\ncursesw\ncurses.h
is a soft-reference in Cygwin, you should manually replace this file withcurses.h
from the same folder From the same Cygwin terminal you can now start Cabal (it's a Windows program!):
$ cabal install terminfo --extra-lib-dirs=c:/cygwin/lib --extra-include-dirs=c:/cygwin/usr/include/ncursesw --extra-include-dirs=c:/cygwin/usr/include
So, the library was installed. But when I try to actually use that function, ghc complains:
Loading package terminfo-0.3.2.5 ... linking ... ghc.exe: c:/cygwin/lib\libncursesw.a: unknown symbol `__imp____ctype_ptr__'
Ncurses static libraries to include with a C++ project
libncurses.a - This is the C compatible library.
libncurses++.a - This is the C++ compatible library.
libncurses_g.a - This is the debug library.
libncurses_p.a - This is the profiling library.
If you want to find out if you can get by without using libncurses.a, you can rename the library and run a build of your application.
How to install ncurses on raspberry Pi?
To install the NCurses library on a Debian based machine you can issue the apt-get
command below:
sudo apt-get install libncurses5-dev libncursesw5-dev
This will install both the libncurses5-dev
(for ncurses) and libncursesw5-dev
(for ncursesw) on your machine.
Related Topics
What Is the Meaning of Each Line of the Assembly Output of a C Hello World
Use Find Command But Exclude Files in Two Directories
No Local Gulp Install Found Even After Installing Npm Install -G Gulp
How to Remove the Win10's Path from Wsl
How to Change All Occurrences of a Word in All Files in a Directory
How to Upgrade Openssl in Centos 6.5/Linux/Unix from Source
How to Make a Computer Behave as a Bluetooth Hid Device
How to Check If There Are Symbolic Links Pointing to a Directory
Bash Scripting - How to Set the Group That New Files Will Be Created With
Check If Directory Mounted with Bash
Is \D Not Supported by Grep's Basic Expressions
Understanding Load Average VS. CPU Usage
Rsync How to Include Directories But Not Files
Bluez: Advertise Service/Gatt Server Example
Is Lib{Library Name}.A/.So a Naming Convention for Static Libraries in Linux
Why Using Pipe for Sort (Linux Command) Is Slow
Why Doing I/O in Linux Is Uninterruptible
What Is the Explanation of This X86 Hello World Using 32-Bit Int 0X80 Linux System Calls from _Start