This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined references compiling gcc with ncurses


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:
> 
> 
> #include<stdio.h>
> #include<curses.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]