* GCC compiler in a cygwin environment.
@ 2002-03-19 4:55 Johansson Mikael (mj)
0 siblings, 0 replies; 3+ messages in thread
From: Johansson Mikael (mj) @ 2002-03-19 4:55 UTC (permalink / raw)
To: gcc-help
Hello.
I have gcc installed in a cygwin environment on win NT.
I cant compile c++ -code to executables in that environment.
From the linker stage I get the following error message:
/usr/tmp/ccRILazb.o(.text+0x1f):Hello.cc: undefined reference to `endl(ostream &)'
/usr/tmp/ccRILazb.o(.text+0x2c):Hello.cc: undefined reference to `cout'
/usr/tmp/ccRILazb.o(.text+0x31):Hello.cc: undefined reference to `ostream::operator<<(char const *)'
/usr/tmp/ccRILazb.o(.text+0x44):Hello.cc: undefined reference to `getch'
If anyone has a clue on this please let me know.
Best regards.
MJ
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: GCC compiler in a cygwin environment.
2002-03-19 5:06 Scott Sinclair
@ 2002-03-19 22:51 ` Suman Kumar Ray
0 siblings, 0 replies; 3+ messages in thread
From: Suman Kumar Ray @ 2002-03-19 22:51 UTC (permalink / raw)
To: gcc-help; +Cc: Scott Sinclair
> I had this problem too. Try calling with g++ to
> force compilation and
> linking as C++. gcc should do the right thing based
> on your file extension
> though ? Sorry I can't be of more help :)
What I have observed is
a> For compilation only , i.e. for -c, g++ treats all
files
as c++ file. Where gcc treats .c etc. files as c file
and .C, .cpp etc. as C++ file, and compile
accordingly. As far as C++ support in compiler is
concerned, there is no difference in gcc and g++
b> For linking, g++ passes by default extra library
for C++, (and someone says math library too), which
gcc does not pass. That is why even if someone can
compiler C++ using gcc, but there will be link error
for c++ library if you do not use g++ as linker
driver.
Thus if someone has a.cpp file, contains class etc.,
it can be build by either of following two commands
1> $>gcc -c a.cpp
$>g++ a.o
or
2> $>g++ a.cpp
I have not seen g++ source. My observation is based on
manuals and old help e-mails. In one one old e-mail, I
have found that it has been complained that for math
header file, g++ uses different path than gcc. But in
cygwin, for 2.95.3 gcc and g++, I have not found that
difference.
Thanks,
Suman Ray
--- Scott Sinclair <scott.sinclair@umgeni.co.za>
wrote:
> Hi
>
> > -----Original Message-----
> > From: Johansson Mikael (mj)
> [mailto:mikael.mj.johansson@volvo.com]
> > Sent: 19/03/2002 14:56
> > To: gcc-help@gcc.gnu.org
> > Subject: GCC compiler in a cygwin environment.
> >
> >
> > Hello.
> >
> > I have gcc installed in a cygwin environment on
> win NT.
> >
> > I cant compile c++ -code to executables in that
> environment.
> > From the linker stage I get the following error
> message:
> >
> > /usr/tmp/ccRILazb.o(.text+0x1f):Hello.cc:
> undefined reference
> > to `endl(ostream &)'
> > /usr/tmp/ccRILazb.o(.text+0x2c):Hello.cc:
> undefined reference
> > to `cout'
> > /usr/tmp/ccRILazb.o(.text+0x31):Hello.cc:
> undefined reference
> > to `ostream::operator<<(char const *)'
> > /usr/tmp/ccRILazb.o(.text+0x44):Hello.cc:
> undefined reference
> > to `getch'
> >
> > If anyone has a clue on this please let me know.
> >
> > Best regards.
> > MJ
> >
>
> I had this problem too. Try calling with g++ to
> force compilation and
> linking as C++. gcc should do the right thing based
> on your file extension
> though ? Sorry I can't be of more help :)
>
> Scott
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: GCC compiler in a cygwin environment.
@ 2002-03-19 5:06 Scott Sinclair
2002-03-19 22:51 ` Suman Kumar Ray
0 siblings, 1 reply; 3+ messages in thread
From: Scott Sinclair @ 2002-03-19 5:06 UTC (permalink / raw)
To: gcc-help
Hi
> -----Original Message-----
> From: Johansson Mikael (mj) [mailto:mikael.mj.johansson@volvo.com]
> Sent: 19/03/2002 14:56
> To: gcc-help@gcc.gnu.org
> Subject: GCC compiler in a cygwin environment.
>
>
> Hello.
>
> I have gcc installed in a cygwin environment on win NT.
>
> I cant compile c++ -code to executables in that environment.
> From the linker stage I get the following error message:
>
> /usr/tmp/ccRILazb.o(.text+0x1f):Hello.cc: undefined reference
> to `endl(ostream &)'
> /usr/tmp/ccRILazb.o(.text+0x2c):Hello.cc: undefined reference
> to `cout'
> /usr/tmp/ccRILazb.o(.text+0x31):Hello.cc: undefined reference
> to `ostream::operator<<(char const *)'
> /usr/tmp/ccRILazb.o(.text+0x44):Hello.cc: undefined reference
> to `getch'
>
> If anyone has a clue on this please let me know.
>
> Best regards.
> MJ
>
I had this problem too. Try calling with g++ to force compilation and
linking as C++. gcc should do the right thing based on your file extension
though ? Sorry I can't be of more help :)
Scott
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-03-20 6:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 4:55 GCC compiler in a cygwin environment Johansson Mikael (mj)
2002-03-19 5:06 Scott Sinclair
2002-03-19 22:51 ` Suman Kumar Ray
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 read-only IMAP folder(s) and NNTP newsgroup(s).