www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/25/14:53:36

Xref: news2.mv.net comp.os.msdos.djgpp:3118
From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: PDCURSES in a C++ program can it be done with djgpp?
Date: Wed, 24 Apr 1996 15:07:19 -0700
Organization: Alcyone Systems
Lines: 30
Message-ID: <317EA617.2BF7FC30@alcyone.com>
References: <199604230851 DOT SAA07134 AT linuxbox DOT nse DOT com DOT au>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

root wrote:

> Ok, I boiled it down to a simplisimus curses program:
> ( the real program is about 32k so I'm not going to flood the world
> with it when a simple example has the same effect ( for me ) )

Without knowing what the error was, it's hard to say what your problem is.  I'm
going to make the assumption that you're actually using the library correctly; in
that case, your problem may be that of a link problem.  If you're trying to link C
code in with C++ code, you must use extern "C" { ... } around the headers that are
being included in the C++ file.  The reason is because C and C++ have different
symbol naming conventions, and without the extern "C" { ... } declaration the linker
is looking for C++-named calls, when in fact they will be C-named calls.

If curses.h doesn't contain the extern "C" { ... } identifiers, the easiest way to
get it done is in your C++ program to include curses.h as:

    extern "C" {
    #include <curses.h>
    }

(I don't know whether the curses library you're using already has the extern "C" {
.... } under a conditional compilation clause, but I'm guessing that it doesn't.)

-- 
Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com
San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019