Compile test ncurses program to run independent of cygwin?

Daniel Goldman dgoldman@ehdp.com
Thu Nov 5 07:51:00 GMT 2015


Rephrasing a previous post, I appreciate the responses, but the question 
was not exactly answered (or I didn't get it).

I want to use cygwin to compile a test ncurses program so it runs in a 
dos terminal, independent of cygwin. Windows 7 / 64 bit PC. Installed 32 
bit cygwin, everything, to d:\cygwin\. Ran cygwin mintty terminal:

------------------------------------------------------------

$ cat ncurses.c
// http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/helloworld.html

#include <curses.h>

int main()
  {
  initscr(); /* Start curses mode */
  printw("Hello World !!!"); /* Print Hello World */
  refresh(); /* Print it on to the real screen */
  getch(); /* Wait for user input */
  endwin(); /* End curses mode */

  return 0;
  }

------------------------------------------------------------

# Compiles and runs perfectly under cygwin, no surprise.
$ gcc ncurses.c -lncurses
$ ./a.exe # runs perfectly

# Found /usr/x86_64-pc-cygwin/sys-root/usr/lib/libncurses.a
# Will this let me compile for dos window? Apparently not.
$ i686-pc-mingw32-gcc -I /usr/x86_64-pc-cygwin/sys-root/usr/include/ 
ncurses.c -L /usr/x86_64-pc-cygwin/sys-root/usr/lib/ -lncurses
... undefined reference to `initscr'
... more "undefined reference" error messages

------------------------------------------------------------

My questions:

1) Did I make a compile-line syntax error? Is there a variation of the 
i686-pc-mingw32-gcc command line so I can use cygwin to compile 
ncurses.c to run in dos window, independent of cygwin?

2) If not, to compile ncurses.c to run in dos window, independent of 
cygwin, do I have to set up the ncurses library myself?

I tried to get an answer from the docs, it seems unclear.

Thanks,
Daniel


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list