delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/04/05:42:38

Date: Thu, 4 Nov 1999 09:14:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: =?big5?B?rdu6+y+kcKjfpGw=?= <lwku AT nlg2 DOT csie DOT ntu DOT edu DOT tw>
cc: djgpp AT delorie DOT com
Subject: Re: Linking problem
In-Reply-To: <000e01bf25d1$0469d320$551f708c@csie.ntu.edu.tw>
Message-ID: <Pine.SUN.3.91.991104091321.9537R-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 3 Nov 1999, =?big5?B?rdu6+y+kcKjfpGw=?= wrote:

Please don't post in HTML.

> I have a problem in linking. I use gcc -c *.c *.cc to compile my source =
> code(one c file, and other c++ files).
>  Then I use gxx -o test.exe *.o to link. There is a linking error:
> 
>     TDT3_I_10.o(.text+0x1195):TDT3_I_10.cc: undefined reference to =
> 'mytag(FILE*,FILE*)'
> 
> mytag(FILE*,FILE*)is in mytagf.c

C functions called from C++ programs need to be declared as ``extern "C"''
in the prototypes visible to the C++ compiler that compiles C++ code which
calls those C functions.

See the DJGPP system headers for how this is done.

This is explained in section 8.10 of the FAQ, btw.

- Raw text -


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