# GCC issues



## Viriix (Mar 15, 2010)

I'm having a problem getting anything cpp based to compile. I can compile just about anything i write in C all day with no problems. However nothing in cpp will compile at all.

The following code:

```
#include <iostream>

int main(int argc, char *argv[])
{
        std::cout << "test" << std::endl;
}
```

produces the following output when ran through GCC:


```
$gcc -o test test.cpp
/var/tmp//ccDcDY7C.o(.text+0x1e): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':'
: undefined reference to `std::string::size() const'
/var/tmp//ccDcDY7C.o(.text+0x69): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccDcDY7C.o(.text+0xa7): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccDcDY7C.o(.text+0xef): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccDcDY7C.o(.text+0x13c): In function `main':
: undefined reference to `std::cout'
/var/tmp//ccDcDY7C.o(.text+0x141): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> 
>(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/var/tmp//ccDcDY7C.o(.text+0x149): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> 
>(std::basic_ostream<char, std::char_traits<char> >&)'
/var/tmp//ccDcDY7C.o(.text+0x151): In function `main':
: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/var/tmp//ccDcDY7C.o(.text+0x18d): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
/var/tmp//ccDcDY7C.o(.text+0x1de): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
/var/tmp//ccDcDY7C.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
```

Any help will be greatly appreciated


----------



## graudeejs (Mar 15, 2010)

use [red]g++[/red] to compile c++ source instead of gcc


----------



## Viriix (Mar 15, 2010)

/me face palms

thanks much


----------

