[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

c++ and ncurses



Hi,

I don't know if this is simply a problem with my setup, but I'm having
problem with the following test program (culled from a larger program).
The program worked fine under Red Hat 5.0:

#include<stdio.h>
#include<curses.h>

int main()
{

   chtype oldchar;

   initscr();

   oldchar = inch();

   return(0);
}

The code compiles and links fine with the c++ compiler (I've tried both
the the old c++ compiler, and egcs.  When the program is run however, I am
getting a segmentation fault.  The fault is occurring on the oldchar =
inch(); line.  If I remove the oldchar =, and just call the inch function,
the program doesn't crash.  Also, if I compile this with the c compiler
instead, I don't have any problems (except that I am using c++ features in
the real program ;-) ).  It looks to me like the return value of inch is
overwriting something it shouldn't.

Any ideas would be appreciated.  If there is a more appropriate list for
this, let me know

Mike Madore 


Reply to: