Hi,
I used getch() in my program, but when i compiled it, it showed
me an error message like
undefined reference to stdscr
undefined reference to wgetch
this is my sample program
#include<curses.h>
int main()
{
char s[10];
int i;
for(i=0;i<10;i++)
{
scanf("%c",&s[i]);
getch();
}
for(i=0;i<10;i++)
printf("%c",s[i]);
}
what wrong in this code.
|
|
0
|
|
|
|
Reply
|
sreekanthtou (10)
|
10/21/2009 5:57:31 AM |
|
In article
<dab3851e-1911-4cf6-bd47-cd6a6ce2af7d@t11g2000prh.googlegroups.com>,
rainbow <sreekanthtou@gmail.com> wrote:
> Hi,
> I used getch() in my program, but when i compiled it, it showed
> me an error message like
>
> undefined reference to stdscr
> undefined reference to wgetch
Check the man page to see if you have to link with a library, e.g.
-lcurses.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
|
|
0
|
|
|
|
Reply
|
barmar (5627)
|
10/21/2009 6:21:47 AM
|
|
rainbow wrote:
> Hi,
> I used getch() in my program, but when i compiled it, it showed
> me an error message like
>
> undefined reference to stdscr
> undefined reference to wgetch
> this is my sample program
>
> #include<curses.h>
> int main()
> {
> char s[10];
> int i;
> for(i=0;i<10;i++)
> {
> scanf("%c",&s[i]);
> getch();
> }
> for(i=0;i<10;i++)
> printf("%c",s[i]);
> }
>
> what wrong in this code.
Well, is getch() what you want there? What are you trying to accomplish,
exactly? The reason that you are getting link errors is, as Barry
indicated, that you are referring to a function in the curses library
but are presumably forgetting to link with that library.
Could you use getchar() instead? That function is in stdio.h, along with
printf() and scanf(), so you want to include it anyway for those
functions. Those are all in the standard library, so you wont have to
link with any extra libraries.
Bjarni
--
INFORMATION WANTS TO BE FREE
|
|
0
|
|
|
|
Reply
|
bjarni (115)
|
10/21/2009 11:54:50 AM
|
|
|
2 Replies
55 Views
(page loaded in 0.104 seconds)
Similiar Articles: Compile time testing for "type equality"? - comp.lang.c++ ...Note: Row_1 and Row_2 may be equal ... SOLUTION: compile time array size using type only - comp.lang ... Thus, the operation is considered a compile-time error. The ... Problem with getch and nodelay, backspace key - comp.unix ...Getch will sometimes return nothing (-2) or just happen to catch the backspace ... NULL, NULL, NULL, &tv); /* a small time delay */ struct timeval tv; error ... Cross-Compile for ARM - NTP 4.1.1 OK, NTP 4.2.0a Errors - comp ...I'm cross-compiling NTP on a Red Hat 7.3 Linux box, targeted at an Arcom ARM-based embedded board, with the Acrom Embedded Linux (AEL) 3.7 (kernel 2.... SOLUTION: compile time array size using type only - comp.lang.c++ ...... define a general template for non-array types template<typename InvalidType> struct array_length { enum {value=0}; //could also force a compile-time error here ... libgcc error while compiling php on Solaris 9 - comp.unix.solaris ...libgcc error while compiling php on Solaris 9 Follow ... and potentially hoark other binaries on your system, use LD_RUN_PATH at compile time to ... const reference typedef compile error: - comp.lang.c++.moderated ...Compile time testing for "type equality"? - comp.lang ... const reference typedef ... member variable without explicit constructor ... const reference typedef compile error ... linker input file unused because linking not done -- compile error ...... to install DBD-mysql-3.0002_5 on Solaris 9 sun 5.9, compiling with gcc 3.4.2 and perl 5.8.8 compiled with the same gcc. Below is the error I get at compilation time ... GCC 4.5.2 compile on solaris 10 - comp.sys.sun.admin... make[2]: *** [all-stage1-gcc] Error 2 ... GCC 4.5.2 compile on solaris 10 - comp ... comp.unix.solaris GCC 4.5.2 compile on solaris 10 - comp.sys.sun.admin The compile time of ... Re: Compile #7 - comp.soft-sys.math.mathematicaCompile time testing for "type equality"? - comp.lang.c++ ... Checksum with no ... const reference typedef compile error: - comp.lang.c++.moderated ... Can someone ... ntpd cross-compiling - comp.protocols.time.ntp... cross compile ntp package : ntp-4.2.4 ... time.ntp Hi all, I am trying to cross compile ntp package : ntp-4.2.4.tar.gz ... Cross-Compile for ARM - NTP 4.1.1 OK, NTP 4.2.0a Errors ... Re: compile time error with getch() - Der Keiler UNIX: The source ...Relevant Pages. Re: using dot_product from c++ II... libraries to be linked in, so it's easier to always link with g++ when ... undefined reference to `_WinMain@16 ... Single character input getch() in Dev-C++ - C and C++ - Forums at ...: I receive a compile-time error to the effect of "implicit definition of function getche ... Still the same result: "Implicit declaration of" getch(), or getche(), or ... 7/16/2012 5:03:21 AM
|