Subject: Linking problems using STL with Mingw32 GCC 2.8.0
From: [email-masked] (Paolo Maggi)

26 Feb 1998 09:06:03 -0800
Message-ID: <[email-masked]>
Reply-To: "Paolo Maggi" <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>

Hi,
I have a problem with Jan-Japp's Mingw32-GCC 2.8.0 (released on Feb 16,
1998).
When a try to compile (and link) programs that use STL I get the following
error messages:

E:\MINGW32\lib/libstdc++.a(stlinst.o)(.data+0x40):stlinst.cc: multiple
definition of `__default_alloc_template<false, 0>::start_free'
d:\TEMP\cc9864451.o(.data$_t24__default_alloc_template2b0i0$start_free+0x0):
ex04-01.cc: first defined here
E:\MINGW32\lib/libstdc++.a(stlinst.o)(.data+0x44):stlinst.cc: multiple
definition of `__default_alloc_template<false, 0>::end_free'
d:\TEMP\cc9864451.o(.data$_t24__default_alloc_template2b0i0$end_free+0x0):ex
04-01.cc: first defined here
E:\MINGW32\lib/libstdc++.a(stlinst.o)(.data+0x48):stlinst.cc: multiple
definition of `__default_alloc_template<false, 0>::heap_size'
d:\TEMP\cc9864451.o(.data$_t24__default_alloc_template2b0i0$heap_size+0x0):e
x04-01.cc: first defined here
E:\MINGW32\lib/libstdc++.a(stlinst.o)(.data+0x4c):stlinst.cc: multiple
definition of `__malloc_alloc_template<0>::__malloc_alloc_oom_handler'
d:\TEMP\cc9864451.o(.data$_t23__malloc_alloc_template1i0$__malloc_alloc_oom_
handler+0x0):ex04-01.cc: first defined here

For example, I get these error messages compiling (and linking) the
following source code:

#include <iostream>
#include <cassert>
#include <algorithm>
#include <list>
#include <string>
int main()
{
  // Initialize array a with 10 integers:
  int a[10] = {12, 3, 25, 7, 11, 213, 7, 123, 29, -31};

  // Find the first element equal to 7 in the array:
  int* ptr = find(&a[0], &a[10], 7);

  assert(*ptr == 7 && *(ptr+1) == 11);

  // Initialize list1 with the same integers as in array a:
  list<int> list1(&a[0], &a[10]);

  // Find the first element equal to 7 in list1:
  list<int>::iterator i = find(list1.begin(), list1.end(),7);

  assert(*i == 7 && *(++i) == 11);
  cout << "Type some characters, including an 'x' followed\n"
    << "by at least one nonwhite-space character: " << flush;
  istream_iterator<char, ptrdiff_t> in(cin);
  istream_iterator<char, ptrdiff_t> eos;
  find(in, eos, 'x');
  cout << "The first nonwhite-space character following\n"
       << "the first 'x' was '" << *(++in) << "'." << endl;
}

Is there a way out?

Thanks a lot.

Paolo

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".