This is the mail archive of the cygwin@cygwin.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]

STL Newbie: vector of strings won't link


To good Samaritans smarter than me,

I wrote a simple program with STL to get familiar with it.  It works on VC++ 6.0, but not gcc-2.95.2-6.

--------------------------------------------------------------

#include <string>
#include <vector>
#include <iostream.h>

using namespace std;      // I've tried it with and without this

void main()
{
    string my_string( "Hello World!\n" );

    vector<string> my_vector;

    my_vector.push_back( my_string );  // It'll link fine without this

    cout << my_vector[0];
}

-------------------------------------------------------------

That's it!

The linker gives an undefined reference error for __uninitialized_copy_aux(...) for string.  Sometimes, it will also give undefined reference error for __destroy_aux(...) for string.

Here's the __uninitialized_copy_aux error message if it makes any difference:  (I'd give the one for __destroy_aux(...) as well, but I can't get it to happen again... it comes and goes.)

stltest.o(.text$__uninitialized_copy__H3ZPt12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0ZPt12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0Zt12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0_X01X01X11PX21_X11+0x21): undefined reference to `basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > * __uninitialized_copy_aux<basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > *, basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > *>(basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > *, basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > *, basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > *, __false_type)'


I've tried the STL library that came with cygwin, SGI STL, and STLport; still didn't work.

Note:  A stack of strings *does* work.

Any help would be much appreciated.

    --Jake



------------------------------------------------------------
Free Entertainment:  Humor, Web Games, & More - http://www.rinkworks.com/
        Free Email:  RinkMail - http://www.rinkworks.com/rinkmail/



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


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