Article View: gnu.gcc.help
Article #52479gcc/g++ linking
From: Johannes Gehrke Betr.Zachmann
Date: Thu, 16 Jul 1992 11:52
Date: Thu, 16 Jul 1992 11:52
87 lines
2570 bytes
2570 bytes
Hi
I have a problem linking gcc and g++ files. My main programm is a c-file which
must be compiled with the gcc because of an old-fashioned c-style which is
generated by a code generator.
The functions which are used in this c-file are implemented in c++, so that
I have two ( or in general more) files: a part of them is compiled with gcc,
the other part is compiled with c++. The names of the functions which are
called in the c-program fit with the names of the implementations in c++.
But the gnu-c++ compiler creates in the c++-files references with other names
than the gcc-compiler in the c-files.
------------------------------------------------
A simple example:
My c-file :
#include "schnittstelle.h"
void main(void)
{
hallo();
}
My C++-file :
#include "schnittstelle.h"
#include <iostream.h>
class tmp
{
public:
tmp() {};
schreibe() { cout << 5; };
~tmp() {};
};
void hallo(void)
{
tmp x;
x.schreibe();
}
the file schnittstelle.h :
void hallo(void);
-------------------------------------------------
the following references are created :
in the c++-file :
00000000 N $L207
00000000 N $L208
00000000 N $L209
00000000 N $L210
00000000 N $L211
00000000 N $L212
00000000 N $L213
00000000 N $L214
00000070 t _$_3tmp
00000000 N _$_3tmp
00000000 N __3tmp
00000000 t __3tmp
U __builtin_delete
U __ls__FR7ostreami
U cout
00000000 N gcc2_compiled.
000000cc T hallo__Fv <---------------
00000030 t schreibe__3tmp
00000000 N schreibe__3tmp
in the c-file:
00000000 N $L1
U __main
00000000 N gcc2_compiled.
U hallo <------------
00000000 T main
As you can see, the references have different names, so the linker does not find them.
I would be very happy to get some feedback or even a solution to this problem.
please mail to : gehrke@ira.uka.de
or answer in this newsgroup.
Thanks :-)
Johannes
Technical Details
Message-ID:
<143nudINNj8u@iraul1.ira.uka.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!gmd.de!ira.uka.de!uka!i40s19!gehrkeShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,985ab832aae2db,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-07-19 23:04:37 PST Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!gmd.de!ira.uka.de!uka!i40s19!gehrke From: gehrke@i40s19.ira.uka.de (Johannes Gehrke Betr.Zachmann) Newsgroups: gnu.gcc.help Subject: gcc/g++ linking Date: 16 Jul 1992 11:52:45 GMT Organization: University of Karlsruhe, FRG Lines: 88 Distribution: uka Message-ID: <143nudINNj8u@iraul1.ira.uka.de> NNTP-Posting-Host: i40s19.ira.uka.de