GNAT and GCC don't coexist happily under Win32

Tom Womack tom@womack.net
Sun Feb 6 12:07:00 GMT 2000


> On Thu, 3 Feb 2000, Tom Womack wrote:
>
> > I'm using Mingw32 (version 2.95.2) under Win32, and recently installed
> > GNAT to be able to play around with Ada. Unfortunately, it looks as
> > if this has constructed two sets of libraries and confused the system
> > horribly.

> Quite a few users I know are using both, and just install these to two
> different places, and consider these two different development systems.
> However, these should in theory be link-compatible at least for C code.
> If not, file a bug report.

I'm not trying to use them link-compatibly - it's just that having GNAT on
my path seems to make Mingw32 get very confused at the link stage. It looks
as if it's trying to link in the C++ library twice and complains at great
length about reused symbols.

[several dozen more lines of this form - how do you capture STDERR in a DOS
box?]
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(new.o)(
.text$__tf9bad_alloc+0x0): multiple definition of `bad_alloc type_info
function'
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(opvnew.
o)(.text$__tf9bad_alloc+0x0): first defined here
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(new.o)(
.text$_$_9exception+0x0): multiple definition of
`exception::~exception(void)'
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(tinfo.o
)(.text$_$_9exception+0x0): first defined here
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(new.o)(
.text$__tf9exception+0x0): multiple definition of `exception type_info
function'
C:\TOOLS\MINGW32\BIN\..\lib\gcc-lib\i386-mingw32msvc\2.95.2/libgcc.a(tinfo.o
)(.text$__tf9exception+0x0): first defined here

This is when I compile the straightforward program below with g++ -O9 -o
test test.cpp:

#include <iostream>
void main(void)
{
  cout << "Hello, world\n";
}

The solution I have at the moment is to alter %PATH% not to point to the
GNAT directory when I'm compiling C++; this is fine, but inelegant. I was
simply wondering whether there was a better way.

Am I right in that GNAT doesn't have the same status as, say, g77 in the gcc
project - it sounds as if even the mythical gcc-3.0.0 will not be buildable
as an Ada compiler out of the .tgz.

Tom



More information about the Gcc mailing list