The Five-Minute Forums  

Go Back   The Five-Minute Forums > FiveMinute.net > Miscellaneous
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2003, 12:38 AM
Angstrom Angstrom is offline
Member
 
Join Date: Apr 2004
Posts: 14
Default

[color=#000000:post_uid0]What's wrong with this code?

[b:post_uid0]ZStreamable.hpp[/b:post_uid0]
[code:1:post_uid0]namespace zilla {
class ZStreamable;
}

std::ostream& operator<<(std::ostream& out, const zilla::ZStreamable& obj); // line 13

namespace zilla {
class ZStreamable {
public:
ZStreamable ();
virtual ~ZStreamable ();

virtual void render (std::ostream &out) const = 0;

friend std::ostream& operator<<(std::ostream& out, const zilla::ZStreamable& obj); // line 23
};
}[/code:1:post_uid0]

[b:post_uid0]PageFooter.hpp[/b:post_uid0]
[code:1:post_uid0]namespace zilla {
class PageFooter : public ZStreamable {
public:
virtual void render (std::ostream &out) const;
};
}[/code:1:post_uid0]

[b:post_uid0]index.cgi.cpp[/b:post_uid0]
[code:1:post_uid0]// other code, main, etc etc
cout << PageFooter (); // line 72
// mode code[/code:1:post_uid0]

[b:post_uid0]make[/b:post_uid0]
[code:1:post_uid0]g++ -g -Wall -pedantic -ansi -lcgicc index.cgi.cpp HTTPHTMLCharsetHeader.o XHTMLDoctype.o PageFooter.o ZStreamable.o -o index.cgi
index.cgi.cpp: In function `int main(int, char**)':
index.cgi.cpp:72: ambiguous overload for `std::ostream& << zilla::PageFooter'
operator
ZStreamable.hpp:13: candidates are: std::ostream& operator<<(std::ostream&,
const zilla::ZStreamable&)
ZStreamable.hpp:23: std::ostream&
zilla::operator<<(std::ostream&, const zilla::ZStreamable&)
ZStreamable.hpp:23: std::ostream&
zilla::operator<<(std::ostream&, const zilla::ZStreamable&)[/code:1:post_uid0][/color:post_uid0]
Reply With Quote
  #2  
Old 04-02-2003, 01:21 AM
Wonko The Sane Wonko The Sane is offline
Member
 
Join Date: Mar 2003
Location: Ontario, Canada
Posts: 169
Send a message via ICQ to Wonko The Sane Send a message via AIM to Wonko The Sane Send a message via MSN to Wonko The Sane
Default

[color=#000000ost_uid0]Yeah, all day today I've been getting a runtime error that sounded something like this:

Line: 176
Error: Unterminated String Constant

Now if I had some clue on how to use C++, I'd know what that would mean...but my programming is limited to Visual Basic and Java.

I figure that the error will be fixed when everything flips back to forwards which is the inverse of the backwards way became when the calender flipped forwards from yesterday to today, and will be rectified when the calender flips forward to the...[okay, you get the picture].
:smile:

EDIT: Did I mention that I only know a very limited amount of Java?[/colorost_uid0]

__________________
Godfather of the wifflebat mafia.

Bears are crazy, they\'ll bite your head off if you\'re wearing steak on it.
Reply With Quote
  #3  
Old 04-02-2003, 01:46 AM
Angstrom Angstrom is offline
Member
 
Join Date: Apr 2004
Posts: 14
Default

[color=#000000ost_uid0]Add a " at the end of the line.

Unterminated string constant means you didn't close a string somewhere.[/colorost_uid0]
Reply With Quote
  #4  
Old 04-02-2003, 02:54 AM
NAHTMMM's Avatar
NAHTMMM NAHTMMM is offline
Noodles And Hot Tofu! MMM
Member
 
Join Date: Mar 2003
Location: St Louis, MO, USA, . . .
Posts: 2,970
Send a message via Yahoo to NAHTMMM
Default

[color=#000000ost_uid0]Maybe you could copy it all into Word, then run a text search to see if everything you want spelled the same *is* spelled the same. That is, tell the program to search for "std:stream&" and see if it skips over any of them. Why strain your eyes looking for missing :'s?[/colorost_uid0]
__________________
My 5MV webpages My novel fivers list

Yup

“There must have been a point in early human history when it was actually advantageous to, when confronted with a difficult task, drop it altogether and go do something more fun, because I do that way too often for it to be anything but instinct.” -- Isto Combs
Reply With Quote
  #5  
Old 04-02-2003, 04:04 AM
Angstrom Angstrom is offline
Member
 
Join Date: Apr 2004
Posts: 14
Default

[color=#000000:post_uid0]Actually, I've already copy/pasted the function definition into the friend definition, and removed unnnecessary scopes. Didn't help any. I think my use of friend is just wrong, but it looks right.[/color:post_uid0]
Reply With Quote
  #6  
Old 04-02-2003, 04:26 AM
NeoMatrix's Avatar
NeoMatrix NeoMatrix is offline
Factorial
Member
 
Join Date: Mar 2003
Location: Augusta, GA
Posts: 6,139
Send a message via AIM to NeoMatrix Send a message via MSN to NeoMatrix Send a message via Yahoo to NeoMatrix
Default

[color=#000000ost_uid0]ooo C++. I should know this since I took 2 years of it. I think the previous people already solved it.[/colorost_uid0]
Reply With Quote
  #7  
Old 04-02-2003, 10:06 PM
Angstrom Angstrom is offline
Member
 
Join Date: Apr 2004
Posts: 14
Default

[color=#000000ost_uid0]Okay, I found it. Subtle bug: the declaration inside ZStreamable declared zilla:perator<< to be a friend, but the actual operator was :perator<< (no namespace).

Besides which I've switched back to cgicc::MStreamable instead of my custom ZStreamable, because I was able to work out my issues from that.[/colorost_uid0]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:49 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.