string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi ,
I have a simple C++ program: (test.cpp)

#include <iostream>
#include <string>
using namespace std;

int main ()
{
    string file="Hello World!";
    return 0;

}

but when I try to compile it this is what I get:
/usr/bin/gcc -o test test.cpp
/tmp/cc3PgfJI.o(.text+0x1c): In function `main':
: undefined reference to `std::allocator<char>::allocator[in-charge]()'
/tmp/cc3PgfJI.o(.text+0x31): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge](char const*, std::allocator<char> const&)'
/tmp/cc3PgfJI.o(.text+0x48): In function `main':
: undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/cc3PgfJI.o(.text+0x65): In function `main':
: undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/cc3PgfJI.o(.text+0x74): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
/tmp/cc3PgfJI.o(.text+0xa4): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/cc3PgfJI.o(.text+0xd3): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/cc3PgfJI.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


these are what I have:
cpp-3.2.2-5
libstdc++-devel-3.2.2-5
compat-libstdc++-7.3-2.96.118
compat-gcc-c++-7.3-2.96.118
compat-libstdc++-devel-7.3-2.96.118
gcc-c++-3.2.2-5
libstdc++-3.2.2-5
gcc-g77-3.2.2-5
gcc-gnat-3.2.2-5
gcc-3.2.2-5



Whats wrong?

any anwer/suggestion is highly appreciated.

Mohammad



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux