c++ and vector on UNIX problem

my code is simply here


#include <iostream>
#include <vector>

using namespace std;

int main (int argc, char * argv[])
{
vector<int> v(10);

return 0;
}


when i compiled with g++ (version 3.1) on unix with command
g++ myfile.cpp


then it shows
Undefined first referenced
symbol in file
std::__default_alloc_template<(bool)1, (int)0>::deallocate(void*, unsigned)/tmp/cc6Ct9tU.o
std::__default_alloc_template<(bool)1, (int)0>::allocate(unsigned)/tmp/cc6Ct9tU.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status


please help

regards,

bida
This looks to me like GCC is configured or installed incorrectly. But if you are using GCC 3.1, you've got bigger problems than a mis-configured compiler.

What platform are you compiling on?
When i logon to shell, it shows

SunOS developer 5.8 Generic_117350-60 sun4u sparc SUNW,Sun-Fire


g++ --version
g++ (GCC) 3.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



thanks and regards,

bida
You might try installing the GCC package for Solaris 8 from sunfreeware.com. That should be configured properly.

blastwave.org has later GCC packages that work well, too.
Topic archived. No new replies allowed.