undefined references compiling gcc with ncurses

2005-10-25 Thread Jeff Scudder
Greetings,
I am a curses newbie and having trouble running a simple curses
program. I haven't run into a discussion thus far on the specific
problem I'm having and I imagine there is a simple solution. My
program is named ctest.c and is as follows:


#includestdio.h
#includecurses.h

int main()
{
  initsscr();
  cbreak();
  noecho();
  char x = getch();
  while(x != 'q')
  {
printf(Entered: %c\n,x);
x = getch();
  }
  endwin();
}

And I compile using

gcc -lncurses ctest.c

When linking I get an undefined reference for each curses function.
I'm sure I'm doing something wrong.

Thank you,

JS

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



Re: undefined references compiling gcc with ncurses

2005-10-25 Thread Reid Thompson

Jeff Scudder wrote:


Greetings,
I am a curses newbie and having trouble running a simple curses
program. I haven't run into a discussion thus far on the specific
problem I'm having and I imagine there is a simple solution. My
program is named ctest.c and is as follows:


#includestdio.h
#includecurses.h

int main()
{
 initsscr();
 cbreak();
 noecho();
 char x = getch();
 while(x != 'q')
 {
   printf(Entered: %c\n,x);
   x = getch();
 }
 endwin();
}

And I compile using

gcc -lncurses ctest.c

When linking I get an undefined reference for each curses function.
I'm sure I'm doing something wrong.

Thank you,

JS

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



#include ncurses.h

or

#include ncurses/ncurses.h


do a
find /usr/include -name ncurses.h  --  i'm not on a cygwin box right now..

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



Re: undefined references compiling gcc with ncurses

2005-10-25 Thread Igor Pechtchanski
On Tue, 25 Oct 2005, Jeff Scudder wrote:

 Greetings,
 I am a curses newbie and having trouble running a simple curses
 program. I haven't run into a discussion thus far on the specific
 problem I'm having and I imagine there is a simple solution. My
 program is named ctest.c and is as follows:
 [snip]
 And I compile using

 gcc -lncurses ctest.c
  ^
 When linking I get an undefined reference for each curses function.
 I'm sure I'm doing something wrong.

Classic newbie mistake.  Libraries should follow source/object files on
the gcc command line.  gcc ctest.c -lncurses should work.  Not
Cygwin-specific.
HTH,
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

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



Re: undefined references compiling gcc with ncurses

2005-10-25 Thread René Berber
Jeff Scudder wrote:

 I am a curses newbie and having trouble running a simple curses
 program. I haven't run into a discussion thus far on the specific
 problem I'm having and I imagine there is a simple solution. My
 program is named ctest.c and is as follows:
 
 
 #includestdio.h
 #includecurses.h
 
 int main()
 {
   initsscr();
^
initscr
   cbreak();
   noecho();
   char x = getch();
   while(x != 'q')
   {
 printf(Entered: %c\n,x);
 x = getch();
   }
   endwin();
 }
 
 And I compile using
 
 gcc -lncurses ctest.c

Try: gcc -o test ctest.c -lncurses

 When linking I get an undefined reference for each curses function.
 I'm sure I'm doing something wrong.

The program doesn't do anything until 'q' is typed...
-- 
René Berber


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



Re: undefined references compiling gcc with ncurses

2005-10-25 Thread Gerrit P. Haase

Jeff Scudder wrote:

Greetings,
I am a curses newbie and having trouble running a simple curses
program. I haven't run into a discussion thus far on the specific
problem I'm having and I imagine there is a simple solution. My
program is named ctest.c and is as follows:


#includestdio.h
#includecurses.h

int main()
{
  initsscr();
  cbreak();
  noecho();
  char x = getch();
  while(x != 'q')
  {
printf(Entered: %c\n,x);
x = getch();
  }
  endwin();
}

And I compile using

gcc -lncurses ctest.c

When linking I get an undefined reference for each curses function.
I'm sure I'm doing something wrong.


Try:
gcc ctest.c -lncurses


Gerrit
--
=^..^=

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