This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linking problems using STL with Mingw32 GCC 2.8.0


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
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]