simple question
lrtaylor@micron.com
lrtaylor@micron.com
Fri Apr 16 16:40:00 GMT 2004
Using gcc for linking c++ programs will not always work, even if you add the C++ library to the link line. For example, exception handling may not work correctly, because things need to be linked slightly differently to properly handle exception handling on certain platforms.
Use g++.
Cheers,
Lyle
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Houda Benabderrazik
Sent: Friday, April 16, 2004 3:07 AM
To: gcc-help@gcc.gnu.org
Cc: Ramin NIkaeen
Subject: Re: simple question
gcc -lstdc++ c.cpp
will work.
--- Ramin NIkaeen <Rnikaeen@goldline.net> a écrit : >
>
> Valued Colleagues,
>
> I have built and installed gcc-3.3 on RedHat linux
> 7.2 but I am having
> problems with the compiler. For several days I have
> been trying to
> figure out the cause of the problem but I have not
> had much success.
>
> Below is a small sample program and the compiler
> error that I get.
>
> If someone can give me any pointers as to the cause
> of the problem,
> I will be very thankful.
>
> best regards
>
> ramin
>
>
>
--------------------------------------------------------------------------------------------
> TEST PROGRAM
>
--------------------------------------------------------------------------------------------
> jupiter.goldline.net:/home/rnikaeen/test>more c.cpp
>
> #include <iostream>
> #include <string>
> using namespace std;
>
> int main()
> {
> cerr << "Enter your name ";
>
> return 0;
> }
>
>
--------------------------------------------------------------------------------------------
> COMPILER OUTPUT
>
--------------------------------------------------------------------------------------------
> jupiter.goldline.net:/home/rnikaeen/test>gcc c.cpp
> /tmp/cc5AisQc.o: In function `main':
> /tmp/cc5AisQc.o(.text+0x1b): undefined reference to
> `std::cerr'
> /tmp/cc5AisQc.o(.text+0x20): 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/cc5AisQc.o: In function
> `__static_initialization_and_destruction_0(int,
> int)':
> /tmp/cc5AisQc.o(.text+0x49): undefined reference to
> `std::ios_base::Init::Init[in-charge]()'
> /tmp/cc5AisQc.o(.text+0x64): undefined reference to
> `std::ios_base::Init::~Init [in-charge]()'
> /tmp/cc5AisQc.o(.eh_frame+0x11): undefined reference
> to `__gxx_personality_v0'
> collect2: ld returned 1 exit status
>
>
--------------------------------------------------------------------------------------------
> gcc VERSION
>
--------------------------------------------------------------------------------------------
> jupiter.goldline.net:/home/rnikaeen/test>which gcc
> /usr/local/bin/gcc
>
>
> jupiter.goldline.net:/home/rnikaeen/test>gcc -v
> Reading specs from
> /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
> Configured with: ./configure
> Thread model: posix
> gcc version 3.3
>
>
--------------------------------------------------------------------------------------------
> RedHat Linux VERSION
>
--------------------------------------------------------------------------------------------
>
jupiter.goldline.net:/usr/local/publicVoiceXML/speech_tools-1.2.3>uname
> -v
> #1 Thu May 29 08:32:50 EDT 2003
>
jupiter.goldline.net:/usr/local/publicVoiceXML/speech_tools-1.2.3>uname
> -a
> Linux jupiter.goldline.net 2.4.20-18.7 #1 Thu May 29
> 08:32:50 EDT 2003 i686 unknown
>
jupiter.goldline.net:/usr/local/publicVoiceXML/speech_tools-1.2.3>
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
More information about the Gcc-help
mailing list