Mail Archives: djgpp/1999/04/10/11:15:33
From: | "David Whitcombe" <mxedisn AT rof DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | _String.h and unresolved externals.
|
Date: | Sat, 10 Apr 1999 00:37:56 -0600
|
Organization: | Rocky Mountain Internet - 1(800)-900-RMII
|
Lines: | 68
|
Message-ID: | <7emrqb$el4$1@news1.rmi.net>
|
NNTP-Posting-Host: | ptp102.rof.net
|
X-Trace: | news1.rmi.net 923726475 15012 209.38.34.102 (10 Apr 1999 06:41:15 GMT)
|
X-Complaints-To: | abuse AT rmi DOT net
|
NNTP-Posting-Date: | 10 Apr 1999 06:41:15 GMT
|
X-Newsreader: | Microsoft Outlook Express 4.72.3155.0
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3155.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I read the FAQs (at least, all the FAQs I could find) I searched on
delorie.com
through the mail archives. I fiddled, I tweaked. I read all the headers in
%DJDIR%/lang/cxx
This fails:
---------------------------------
#include <_String.h>
int main(void)
{
String x="Straw? No, too stupid. I put soot on warts.";
String y=x;
if (x==y) printf("Sit on a potato pan, Otis.");
return 0;
}
---------------------------------
It chokes during link with:
-----------------
Error: test.o: In function `main':
test.cpp(1) Error: undefined reference to `String::String(char const *)'
test.cpp(2) Error: undefined reference to `String::String(String const &)
test.cpp(3) Error: undefined reference to `operator==(String const &, Str
test.cpp(4) Error: undefined reference to `String::~String(void)'
Error: test.cpp(.text+0xc3): undefined reference to `String::~String(void
Error: test.cpp(.text+0xf7): undefined reference to `String::~String(void
Error: test.cpp(.text+0x117): undefined reference to `String::~String(voi
There were some errors
--------------------------------------
No doubt.
The command that RHIDE is using to do the link is:
------------
gcc -o test.exe test.o -lgpp -lstdcxx
I'm using libgpp2.8.1.1, gcc2.8.1, and rhide 1.4 (although, that doesn't
seem to matter,
as when I type the commands myself, it fails just as wonderfully).
I read on the mail archives that this might be a libgpp2.8 binary
distribution bug, where
someone wrote that when he compiled with optimization, the error
disappeared, due
to the fact that all the methods are declared inline in _String.h, and
something mysterious
happens to them when optimizations are turned off.
Does this make sense?
I can do other C++ stuff, like iostreams, and it doesn't complain one whit.
The compiler doesn't complain until link time.
I'm new to comp.os.msdos.djgpp, but not to C and C++...
Any suggestions would be mightily appreciated, as, though fond as I am of
reinventing
wheels, I'd really rather not write another string class.
I'm tired of writing string classes.
"Hear about the new object oriented cobol? It's called
Add_one_to_cobol_and_store_result_in_cobol."
- Raw text -