[luau] C program question

Eric Hattemer hattenator at imapmail.org
Thu May 23 01:50:01 PDT 2002


Here's most of the deal.  On my school's solaris machine I still get a
redefinition error.  But there's two problems that I found.  First,
according to the man, "The header file curses.h automatically includes the
header file stdio.h. "  Second, curses is one of those special libraries
like math.h that requires a -l flag for gcc.  So change your makefile to say
"gcc -lcurses ... MOD.c".  See if that helps.  I'm getting a segmentation
fault and redefinition errors on mine, but I don't know anything about
curses.

-Eric Hattemer
----- Original Message -----
From: "Ben Beeson" <beesond001 at hawaii.rr.com>
To: "LUAU" <luau at videl.ics.hawaii.edu>
Sent: Wednesday, May 22, 2002 11:33 PM
Subject: [luau] C program question


> Aloha,
>
> I'm wrestling with a little program....  What I want is for the program to
> "pause" for a moment when it is done with output until the user presses a
> key. Then it should continue.   What I thought should work is this:
>
>
> #include <curses.h>
> #include <stdio.h>
> #include <stdlib.h> /* for exit function */
> #include <string.h>
> #include <assert.h>
> #include <ctype.h>
> -
> -
>   fprintf(stdout,"Press any key to proceed.\n");
>   getch();
> -
> -
> -
>
> When I "make" this it returns errors like this:
> [ben at VALinux nitroxblender]$ make
> gcc -Wall -g -c MOD.c
> gcc -Wall -g -o MOD MOD.o
> MOD.o: In function `best_mix':
> /home/ben/devel/nitroxblender/MOD.c:365: undefined reference to `stdscr'
> /home/ben/devel/nitroxblender/MOD.c:365: undefined reference to `wgetch'
> collect2: ld returned 1 exit status
> make: *** [MOD] Error 1
>
> So my question is why do I get undefined references to `stdscr'  and
`wgetch'
> when the compiler gets to the line with the call to getch()???
>
> This should be easy, but for the life of me it escapes me.  Any ideas
would
> be greatly appreciated.
>
> Thanks,
>
> Ben
> _______________________________________________
> LUAU mailing list
> LUAU at videl.ics.hawaii.edu
> http://videl.ics.hawaii.edu/mailman/listinfo/luau
>
>




More information about the LUAU mailing list