* Mistake With CPP File
@ 2002-07-31 11:04 SoloCDM
2002-08-01 7:09 ` Robert Schiele
0 siblings, 1 reply; 8+ messages in thread
From: SoloCDM @ 2002-07-31 11:04 UTC (permalink / raw)
To: Linux-Gcc (Majordomo)
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
Recently I tried to compile fig01_02.cpp with Kernel 2.2.20 on Linux
Mandrake 8.0. I used "gcc fig01_02.cpp" and received the following
errors:
<user_account>/tmp/ccmeDWKS.o: In function `main':
<user_account>/tmp/ccmeDWKS.o(.text+0xf): undefined reference to
`cout'
<user_account>/tmp/ccmeDWKS.o(.text+0x14): undefined reference to
`ostream::operator<<(char const *)'collect2: ld returned 1 exit status
Why didn't it work?
I attached the file in question.
--
Note: When you reply to this message, please include the mailing
list/newsgroup address and my email address in To:.
*********************************************************************
Signed,
SoloCDM
[-- Attachment #2: fig01_02.cpp --]
[-- Type: text/plain, Size: 178 bytes --]
// Fig. 1.2: fig01_02.cpp
// A first program in C++
#include <iostream.h>
int main()
{
cout << "Welcome to C++!\n";
return 0; // indicate that program ended successfully
}
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Mistake With CPP File
2002-07-31 11:04 Mistake With CPP File SoloCDM
@ 2002-08-01 7:09 ` Robert Schiele
2002-08-01 8:38 ` SoloCDM
0 siblings, 1 reply; 8+ messages in thread
From: Robert Schiele @ 2002-08-01 7:09 UTC (permalink / raw)
To: deedsmis, linux-gcc
[-- Attachment #1: Type: text/plain, Size: 740 bytes --]
On Wed, Jul 31, 2002 at 05:04:04AM -0600, SoloCDM wrote:
> Recently I tried to compile fig01_02.cpp with Kernel 2.2.20 on Linux
> Mandrake 8.0. I used "gcc fig01_02.cpp" and received the following
> errors:
>
> <user_account>/tmp/ccmeDWKS.o: In function `main':
> <user_account>/tmp/ccmeDWKS.o(.text+0xf): undefined reference to
> `cout'
> <user_account>/tmp/ccmeDWKS.o(.text+0x14): undefined reference to
> `ostream::operator<<(char const *)'collect2: ld returned 1 exit status
>
> Why didn't it work?
cout is in libstdc++. So either you have to call "g++ fig01_02.cpp" or
"gcc -lstdc++ fig01_02.cpp".
Robert
--
Robert Schiele Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker mailto:rschiele@uni-mannheim.de
[-- Attachment #2: Type: application/pgp-signature, Size: 524 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Mistake With CPP File
2002-08-01 7:09 ` Robert Schiele
@ 2002-08-01 8:38 ` SoloCDM
2002-08-01 13:33 ` Robert Schiele
0 siblings, 1 reply; 8+ messages in thread
From: SoloCDM @ 2002-08-01 8:38 UTC (permalink / raw)
To: Robert Schiele; +Cc: Linux-GCC (Majordomo)
Robert Schiele stated the following:
>
> On Wed, Jul 31, 2002 at 05:04:04AM -0600, SoloCDM wrote:
> > Recently I tried to compile fig01_02.cpp with Kernel 2.2.20 on Linux
> > Mandrake 8.0. I used "gcc fig01_02.cpp" and received the following
> > errors:
> >
> > <user_account>/tmp/ccmeDWKS.o: In function `main':
> > <user_account>/tmp/ccmeDWKS.o(.text+0xf): undefined reference to
> > `cout'
> > <user_account>/tmp/ccmeDWKS.o(.text+0x14): undefined reference to
> > `ostream::operator<<(char const *)'collect2: ld returned 1 exit status
> >
> > Why didn't it work?
>
> cout is in libstdc++. So either you have to call "g++ fig01_02.cpp" or
> "gcc -lstdc++ fig01_02.cpp".
It worked -- Thanks!
I couldn't help but notice how g++ linked all the way back to
colorgcc. Although, colorgcc doesn't react like g++. Colorgcc won't
create a.out.
What is gcc used for? I noticed it seems to have some of the same
files or libraries as g++.
--
Note: When you reply to this message, please include the mailing
list and/or newsgroup address and my email address in To:
*********************************************************************
Signed,
SoloCDM
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Mistake With CPP File
2002-08-01 8:38 ` SoloCDM
@ 2002-08-01 13:33 ` Robert Schiele
2002-08-02 12:47 ` SoloCDM
0 siblings, 1 reply; 8+ messages in thread
From: Robert Schiele @ 2002-08-01 13:33 UTC (permalink / raw)
To: deedsmis, linux-gcc
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
On Thu, Aug 01, 2002 at 02:38:32AM -0600, SoloCDM wrote:
> Robert Schiele stated the following:
> > cout is in libstdc++. So either you have to call "g++ fig01_02.cpp" or
> > "gcc -lstdc++ fig01_02.cpp".
>
> It worked -- Thanks!
>
> I couldn't help but notice how g++ linked all the way back to
> colorgcc. Although, colorgcc doesn't react like g++. Colorgcc won't
> create a.out.
Sorry, but I cannot see what you wanted to tell us with this
paragraph.
> What is gcc used for? I noticed it seems to have some of the same
> files or libraries as g++.
gcc and g++ are the same, but gcc uses C as it's standard language,
where g++ uses C++ as standard language and links standard C++
libraries without the need to specify them explicitly.
Robert
--
Robert Schiele Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker mailto:rschiele@uni-mannheim.de
[-- Attachment #2: Type: application/pgp-signature, Size: 524 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Mistake With CPP File
2002-08-01 13:33 ` Robert Schiele
@ 2002-08-02 12:47 ` SoloCDM
2002-08-02 13:08 ` Robert Schiele
0 siblings, 1 reply; 8+ messages in thread
From: SoloCDM @ 2002-08-02 12:47 UTC (permalink / raw)
To: Robert Schiele; +Cc: Linux-GCC (Majordomo)
Robert Schiele stated the following:
>
> On Thu, Aug 01, 2002 at 02:38:32AM -0600, SoloCDM wrote:
>
> > Robert Schiele stated the following:
> >
> > > cout is in libstdc++. So either you have to call "g++ fig01_02.cpp" or
> > > "gcc -lstdc++ fig01_02.cpp".
> >
> > It worked -- Thanks!
> >
> > I couldn't help but notice how g++ linked all the way back to
> > colorgcc. Although, colorgcc doesn't react like g++. Colorgcc won't
> > create a.out.
>
> Sorry, but I cannot see what you wanted to tell us with this
> paragraph.
It starts the linking (ln command) with /usr/bin/g++ -->
/etc/alternatives/g++ --> /usr/bin/colorg++ --> /usr/bin/colorgcc.
G++ is acting as a link. If executed in the same manner as g++ to
create an a.out file, without options, colorgcc doesn't execute like
g++.
> > What is gcc used for? I noticed it seems to have some of the same
> > files or libraries as g++.
>
> gcc and g++ are the same, but gcc uses C as it's standard language,
> where g++ uses C++ as standard language and links standard C++
> libraries without the need to specify them explicitly.
Is the documentation on my system to know how to use different things
like "-lstdc++" with g++? What would the files be? I didn't find
anything in the man page.
--
Note: When you reply to this message, please include the mailing
list and/or newsgroup address and my email address in To:
*********************************************************************
Signed,
SoloCDM
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Mistake With CPP File
2002-08-02 12:47 ` SoloCDM
@ 2002-08-02 13:08 ` Robert Schiele
2002-08-02 18:18 ` SoloCDM
0 siblings, 1 reply; 8+ messages in thread
From: Robert Schiele @ 2002-08-02 13:08 UTC (permalink / raw)
To: deedsmis, linux-gcc
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
On Fri, Aug 02, 2002 at 06:47:41AM -0600, SoloCDM wrote:
> It starts the linking (ln command) with /usr/bin/g++ -->
> /etc/alternatives/g++ --> /usr/bin/colorg++ --> /usr/bin/colorgcc.
> G++ is acting as a link. If executed in the same manner as g++ to
> create an a.out file, without options, colorgcc doesn't execute like
> g++.
What do you have in ~/.colorgccrc?
> Is the documentation on my system to know how to use different things
> like "-lstdc++" with g++? What would the files be? I didn't find
> anything in the man page.
Try "info gcc".
Robert
--
Robert Schiele Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker mailto:rschiele@uni-mannheim.de
[-- Attachment #2: Type: application/pgp-signature, Size: 524 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Mistake With CPP File
2002-08-02 13:08 ` Robert Schiele
@ 2002-08-02 18:18 ` SoloCDM
2002-08-02 21:40 ` Robert Schiele
0 siblings, 1 reply; 8+ messages in thread
From: SoloCDM @ 2002-08-02 18:18 UTC (permalink / raw)
To: Robert Schiele; +Cc: Linux-GCC (Majordomo)
Robert Schiele stated the following:
>
> On Fri, Aug 02, 2002 at 06:47:41AM -0600, SoloCDM wrote:
>
> > It starts the linking (ln command) with /usr/bin/g++ -->
> > /etc/alternatives/g++ --> /usr/bin/colorg++ --> /usr/bin/colorgcc.
> > G++ is acting as a link. If executed in the same manner as g++ to
> > create an a.out file, without options, colorgcc doesn't execute like
> > g++.
>
> What do you have in ~/.colorgccrc?
No such file exists. Everything for g++ and gcc is exactly as it was
installed.
--
Note: When you reply to this message, please include the mailing
list and/or newsgroup address and my email address in To:
*********************************************************************
Signed,
SoloCDM
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Mistake With CPP File
2002-08-02 18:18 ` SoloCDM
@ 2002-08-02 21:40 ` Robert Schiele
0 siblings, 0 replies; 8+ messages in thread
From: Robert Schiele @ 2002-08-02 21:40 UTC (permalink / raw)
To: deedsmis, linux-gcc
[-- Attachment #1: Type: text/plain, Size: 956 bytes --]
On Fri, Aug 02, 2002 at 12:18:49PM -0600, SoloCDM wrote:
> Robert Schiele stated the following:
> >
> > On Fri, Aug 02, 2002 at 06:47:41AM -0600, SoloCDM wrote:
> >
> > > It starts the linking (ln command) with /usr/bin/g++ -->
> > > /etc/alternatives/g++ --> /usr/bin/colorg++ --> /usr/bin/colorgcc.
> > > G++ is acting as a link. If executed in the same manner as g++ to
> > > create an a.out file, without options, colorgcc doesn't execute like
> > > g++.
> >
> > What do you have in ~/.colorgccrc?
>
> No such file exists. Everything for g++ and gcc is exactly as it was
> installed.
Then your installation of colorgcc is braindead, as you have an
infinite loop, because colorgcc runs /usr/bin/g++ by default, which is
itself in your case. You need to specify the path to your real g++ in
the config file.
Robert
--
Robert Schiele Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker mailto:rschiele@uni-mannheim.de
[-- Attachment #2: Type: application/pgp-signature, Size: 524 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-08-02 21:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-31 11:04 Mistake With CPP File SoloCDM
2002-08-01 7:09 ` Robert Schiele
2002-08-01 8:38 ` SoloCDM
2002-08-01 13:33 ` Robert Schiele
2002-08-02 12:47 ` SoloCDM
2002-08-02 13:08 ` Robert Schiele
2002-08-02 18:18 ` SoloCDM
2002-08-02 21:40 ` Robert Schiele
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).