* problems with String.h
@ 1997-04-07 18:53 DRS
1997-04-07 22:56 ` James Paul Morgan
0 siblings, 1 reply; 3+ messages in thread
From: DRS @ 1997-04-07 18:53 UTC (permalink / raw)
To: gnu-win32
Greetings,
The following works fine under GCC on Solaris (at school) but fails
under
my gnu-win32 setup at home:
//g++ -c str.cpp
//g++ -o str.exe str.o
#include <strclass.h>
#include <iostream.h>
main()
{
string str("This is a test.");
cout << str << endl;
return 0;
}
/*
str.o(.text+0x35):str.cc: undefined reference to `String::String(char co
str.o(.text+0x4b):str.cc: undefined reference to `operator<<(ostream &,
onst &)'
str.o(.text+0x66):str.cc: undefined reference to `String::~String(void)'
*/
Is this simply a configuration problem, or what? I was wondering if it
had
to do with the string.h/String.h name collision. I have no problem using
iostream.h, which looks to be in the same directory. Ideas anyone?
Thank-you in advance for your help,
DRS
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: problems with String.h
1997-04-07 18:53 problems with String.h DRS
@ 1997-04-07 22:56 ` James Paul Morgan
0 siblings, 0 replies; 3+ messages in thread
From: James Paul Morgan @ 1997-04-07 22:56 UTC (permalink / raw)
To: gnu-win32
The g++ with Cygnus gives priority to /include/g++ over the
/H-i386../i386/include directory. In fact, I had to rename a .h file in
the latter directory becuase the /include/g++ was being used instead.
An undefined reference means your program referred to that but there is
no definition for it. In other words, String::String() does not exist in
any of the linked files of libraries.
I just compiled that code with:
g++ test.cpp -lg++
That worked fine. You just need to link against the g++ library.
On Mon, 7 Apr 1997, DRS wrote:
> #include <strclass.h>
> #include <iostream.h>
>
> main()
> {
> string str("This is a test.");
> cout << str << endl;
> return 0;
>
> }
>
> /*
> str.o(.text+0x35):str.cc: undefined reference to `String::String(char co
> str.o(.text+0x4b):str.cc: undefined reference to `operator<<(ostream &,
> onst &)'
> str.o(.text+0x66):str.cc: undefined reference to `String::~String(void)'
> */
>
See ya around the Mulberry bush.
--James
:)
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: problems with String.h
@ 1997-04-08 6:14 Larry Hall
0 siblings, 0 replies; 3+ messages in thread
From: Larry Hall @ 1997-04-08 6:14 UTC (permalink / raw)
To: drs, gnu-win32
At 08:51 PM 4/7/97 -0500, DRS wrote:
>Greetings,
>
>The following works fine under GCC on Solaris (at school) but fails
>under
>my gnu-win32 setup at home:
>
>//g++ -c str.cpp
>//g++ -o str.exe str.o
>
>#include <strclass.h>
>#include <iostream.h>
>
>main()
>{
> string str("This is a test.");
> cout << str << endl;
> return 0;
>
>}
>
>/*
>str.o(.text+0x35):str.cc: undefined reference to `String::String(char co
>str.o(.text+0x4b):str.cc: undefined reference to `operator<<(ostream &,
>onst &)'
>str.o(.text+0x66):str.cc: undefined reference to `String::~String(void)'
>*/
>
>Is this simply a configuration problem, or what? I was wondering if it
>had
>to do with the string.h/String.h name collision. I have no problem using
>iostream.h, which looks to be in the same directory. Ideas anyone?
>
>Thank-you in advance for your help,
>
>DRS
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>
For me, linking with -lg++ did the trick. I'm not sure why this library
isn't included by default....
Larry
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-04-08 6:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-07 18:53 problems with String.h DRS
1997-04-07 22:56 ` James Paul Morgan
1997-04-08 6:14 Larry Hall
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).