Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Jan 1997 20:35:41 +1100 (EST)
From:      peter.jeremy@alcatel.com.au
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2382: curses.h / -lcurses incompatible with C++
Message-ID:  <199701060935.UAA27320@vk2pj.alcatel.com.au>
Resent-Message-ID: <199701060940.BAA23260@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2382
>Category:       bin
>Synopsis:       curses.h / -lcurses incompatible with C++
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan  6 01:40:03 PST 1997
>Last-Modified:
>Originator:     Peter Jeremy
>Organization:
Peter Jeremy (VK2PJ)			peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St				Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015			Fax:   +61 2 9690 5247
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

none

>Description:

The prototypes in /usr/include/curses.h are not protected in an extern "C" {}
block.  This causes C++ programs using -lcurses to report undefined symbols
during linking.

>How-To-Repeat:

$ cat > x.C <<__EOF__
#include "curses.h"	// since > < gets eaten

int main(int argc, char **argv)
{
	WINDOW	*w;

	w = initscr();
}
__EOF__
$ gcc x.C -lcurses
/tmp/cc0142051.o: Undefined symbol `_initscr__Fv' referenced from text segment
$

>Fix:
	
*** /cdrom/usr/src/lib/libcurses/curses.h	Sat Sep  2 13:41:59 1995
--- /usr/src/lib/libcurses/curses.h	Wed Dec 11 20:43:18 1996
***************
*** 277,282 ****
--- 277,283 ----
  #define	winch(w) \
  	((w)->lines[(w)->cury]->line[(w)->curx].ch & 0377)
  
+ __BEGIN_DECLS
  /* Public function prototypes. */
  int	 box __P((WINDOW *, int, int));
  int	 cbreak __P((void));
***************
*** 388,392 ****
--- 389,394 ----
  int      tgetflag __P((const char *));
  char    *tgetstr __P((const char *, char **));
  char    *tgoto __P((const char *, int, int));
+ __END_DECLS
  
  #endif /* !_CURSES_H_ */

(And the same change to /usr/include/curses.h)
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701060935.UAA27320>