delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/14/01:51:49

Date: Tue, 14 Jan 1997 08:30:37 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Panos Platon Tsapralis <panosts AT hiway DOT gr>
cc: "DJGPP/D.J.Delorie Mailing List" <djgpp AT delorie DOT com>
Subject: Re: Linking Problems With PDCurses Package.
In-Reply-To: <199701131742.PAA04964@cosmos.hiway.gr>
Message-ID: <Pine.SUN.3.91.970114081810.11860E-100000@is>
MIME-Version: 1.0

On Mon, 13 Jan 1997, Panos Platon Tsapralis wrote:

> Error: c:/djgpp/lib/libcurso.a(initscr.o)(.text+0x189):initscr.c :
> undefined reference to `_iob'

This means that your PDCurses were compiled with DJGPP v1.x.  Get 
v2tk/pdc22.zip from SimTel.NET and compile and link against it (note that 
it is safer to both compile and link, since some changes between v1.x and 
v2 are in the header files).

> 	I also want to mention that I compile ( and link ) the same program on my
> system at home, ( which has a copy of the DJGPP compiler, that, I believe,
> is identical to that of the system at my office ), without getting the
> above error message ( the home system's compiler produces a perfectly
> running executable file ).

You either have a v2 PDCurses at home, or you work with DJGPP v1.x there.

> 	I strongly suspect that the PDCurses package cannot be used with C++
> programs. Does anyone have a better opinion or something to suggest ?

That is correct, but the fix is easy.  Just edit the PDCurses header 
files and add the following before the first line that declares a 
function prototype:

	#ifdef __cplusplus
	extern "C" {
	#endif

then add this after the last prototype:

	#ifdef __cplusplus
	}
	#endif

That's it!  Now the explanation: C++ generally requires that you have a
prototype declaration for every combination of argument types with which
any given function will be called by your program.  The above magic tells
the C++ compiler that the functions declared between these two places are
C (as opposed to C++) functions, so the compiler is satusfied and doesn't
complain. 

Last, but not least: please don't cc: your messages to 
<listserv AT delorie DOT com>.  That is an address of a program that handles 
subscribe/unsubscribe messages, so sending it mail which is meant to be 
read by humans only produces error messages and requires DJ Delorie to 
wade through them.

- Raw text -


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