🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3505

Re: HELP: Curses on SunOS...

#3505
From: Dan Zerkle
Date: Thu, 22 Jun 1995 00:00
48 lines
2225 bytes
Charles Ofria (charles@rigel.krl.caltech.edu) wrote:
: Greetings,

: 	I've been working on a program with a curses interface for quite
: some time now, and it is working perfectly on the Alpha and HP machines
: which I primarily use.  

: view.cc:18: `SIGINT' undeclared (first use this function)
: view.cc:18: warning: implicit declaration of function `int signal(...)'

Looks to me like you need to:

#include <signal.h>


In C++, you should declare all your functions (with prototypes) before you
try to use them.  Some commonly used functions are declared in <unistd.h>,
so you might try including that.  If you've included all the files indicated
in the manual page, and you still get this warning, try the following:

extern "C" {
  // declare functions here
}

Put this outside of any function scope.  

Basically, C++ functions are not the same as C functions, so you need to
declare them as such.

The curses manual is long and complicated, and I don't feel like looking it
up, so here's an example from some code of mine that uses sockets:

extern "C"
{
  extern int sendto(int, char *, int, int, struct sockaddr *, int);
  extern int bind(int s, struct sockaddr *name, int namelen);
  extern int connect(int, struct sockaddr *, int);
  extern int socket(int, int, int);
  extern int getsockname(int, struct sockaddr *, int *);
  extern void bcopy(void *, void *, int);
}

You can do the same thing for your curses library functions.
 
--
Dan Zerkle  zerkle@cs.ucdavis.edu
GCS d(---)(!) p- c++ !l u++ e++(+++) m s++/-- !n h+(--) f g+++(-) w+ t+ r(-) y+
You call some place "Paradise" -- Kiss it goodbye.
Technical Details
Message-ID: <3salhv$dce@mark.ucdavis.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3s9n9q$pas@gap.cco.caltech.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc89c,4a274b7abdd7681e
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 10ba33,4a274b7abdd7681e
X-Google-Attributes: gid10ba33,public
From: zerkle@toadflax.cs.ucdavis.edu (Dan Zerkle)
Subject: Re: HELP: Curses on SunOS...
Date: 1995/06/22
Message-ID: <3salhv$dce@mark.ucdavis.edu>
X-Deja-AN: 104876912
references: <3s9n9q$pas@gap.cco.caltech.edu>
followup-to: comp.unix.programmer,gnu.g++.help
organization: University of California, Davis
newsgroups: comp.unix.programmer,gnu.g++.help