Re: Possible GCC problem

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

 



On 02 Jan 2004 18:19:15 -0600, Michael Sullivan wrote:

> This isn't exactly strictly Red Hat related, but since I get all my GCC
> updates from Red Hat's up2date I thought you all might want to see
> this.  I was writing a program that used arrays in C++ and it kept
> saying that I had a "parse error before [".  I checked my code and it
> looked perfectly legal.  I tried and tried to get it to work, but it
> wouldn't.  I commented the array statement out and tried to compile it. 
> It compiled, but wouldn't link.  I decided to try an experiement by
> trying the "Hello World" program.  Here is my program code for
> hello.cpp:
> 
> #include <iostream>
> using namespace std;
> 
> int main()
> {
>         cout << "Hello!\n";
>         return 0;
> }
> 
> I think it looks perfectly legal.  Here's what it said when I tried to
> compile it:
> 
> [michael@baby michael]$ gcc -o hello hello.cpp
> /tmp/cc7kExcK.o(.text+0x19): In function `main':
> : undefined reference to `std::cout'
> /tmp/cc7kExcK.o(.text+0x1e): 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*)'
> /tmp/cc7kExcK.o(.text+0x4a): In function
> `__static_initialization_and_destruction_0(int, int)':
> : undefined reference to `std::ios_base::Init::Init[in-charge]()'
> /tmp/cc7kExcK.o(.text+0x79): In function `__tcf_0':
> : undefined reference to `std::ios_base::Init::~Init [in-charge]()'
> /tmp/cc7kExcK.o(.eh_frame+0x11): undefined reference to
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
> 
> Does anyone know a solution to this?

Compile with g++, not gcc.
 
-- 

Attachment: pgp00823.pgp
Description: PGP signature


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux