Article View: gnu.gcc.help
Article #42624Mixed G++ - GCC programs and Shared library
From: David M. Ronis
Date: Thu, 16 Nov 1995 00:00
Date: Thu, 16 Nov 1995 00:00
38 lines
1767 bytes
1767 bytes
I mainly program in C, but occasionally have to do calculations that
involve complex arithmetic. I've found that C++'s operator
overloading conveniently allows me to basically take a C program, add
a few Complex and extern "C" {} statements, and create a C++ program
that includes complex mixed mode arithmetic. (At least it appears to
work to one who is not an experienced C++ programmer).
Recently, I've been working on a project that needs complex arithmetic
in only one of its modules. The rest of the code is written in C and
is either included as .o files on the command line, or is in
libraries.
It is the code in the libraries that is giving me trouble. When I
link, I get a slew of unresolved externals (usually variable
names). The library is sharable and was created for ELF format with
gcc(2.7.0) using -fpic. If I include the source or compiled object
files explicitly on the gcc command line the problem goes away, but
this is a pain when a large number of modules are required.
I'm running Linux and have set things up for ELF targets. I've also
tried using
either
g++ $(CFLAGS) -o foo $(OBJS) -lmy_lib -lm
or
gcc $(CFLAGS) -o foo $(OBJS) -lmy_lib -lm -lg++ -liostream
with the same results/problems.
Any help would be appreciated.
Thanks in advance.
David Ronis
Technical Details
Message-ID:
<gnusenet48adnp$r7c@sifon.cc.mcgill.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,9b890333fb655209,start X-Google-Attributes: gid11318c,public From: ronis@complex.is (David M. Ronis) Subject: Mixed G++ - GCC programs and Shared library Date: 1995/11/16 Message-ID: <gnusenet48adnp$r7c@sifon.cc.mcgill.ca> X-Deja-AN: 119515615 distribution: gnu sender: daemon@cis.ohio-state.edu organization: McGill University newsgroups: gnu.gcc.help