Re: gcc/g++ fails to compile

Phil C <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
>It is hard to tell what the problem is without sample code and the exact error message along with some details >about your system configuration.


>Regards

 >       \Steve

Sorry for the lack of information I hope this makes the situation more clear. I'm using Ubuntu Linux 8.04 and every current stable patch kernel wise. GCC is version 4.3 Remaining info is as follows.

//Sample Code

#include<iostream>
using namespace std;

int main() {
    cout <<"Hello World";
    return 0;
}

//Error message copied from terminal

/tmp/ccERz0tv.o:
In function `std::__verify_grouping(char const*, unsigned int,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
test.cpp:(.text+0xe):
undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::size()
const'
test.cpp:(.text+0x59): undefined reference to
`std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::operator[](unsigned int) const'
test.cpp:(.text+0x97):
undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::operator[](unsigned int) const'
test.cpp:(.text+0xdf):
undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::operator[](unsigned int) const'
/tmp/ccERz0tv.o: In function `main':
test.cpp:(.text+0x128): undefined reference to `std::cout'
test.cpp:(.text+0x12d):
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*)'
/tmp/ccERz0tv.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x15d): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccERz0tv.o: In function `__tcf_0':
test.cpp:(.text+0x1aa): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccERz0tv.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

 - Phil C
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.