954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with School Project...

Hey, I am in the process of writing a program that stores a integer entry into an array where each element in that array directly corresponds to a date on the calendar for that month. I think I have my code working, or at least almost working. My problem comes when I am trying to include apstring.h into it. I get the following errors:

Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int apstring.h 70

Error 2 error C2556: 'std::ostream &operator <<(std::ostream &,const apstring &)' : overloaded function differs only by return type from 'int &operator <<(std::ostream &,const apstring &)' apstring.cpp 166

Error 3 error C2371: 'operator <<' : redefinition; different basic types c:\documents and settings\hooker\desktop\logbook\apstring.cpp 166


I have tried to understand what is up and have done several google searches to try to figure this out but have had no luck... In my efforts I actually went from 22 errors to just these three but now I am stuck... My code is attached and I am using VS 2005. Test1.cpp is the test program to test my work.

Thanks for the help!

Attachments apstring.cpp (11.08KB) apstring.h (8.48KB) logbook.cpp (5.66KB) logbook.h (1.56KB) test1.cpp (3.24KB)
theflier13
Newbie Poster
4 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int apstring.h 70

Error 2 error C2556: 'std::ostream &operator <<(std::ostream &,const apstring &)' : overloaded function differs only by return type from 'int &operator <<(std::ostream &,const apstring &)' apstring.cpp 166

Error 3 error C2371: 'operator <<' : redefinition; different basic types c:\documents and settings\hooker\desktop\logbook\apstring.cpp 166


apstring.h has this typoed line in it.

ostream ;& operator << ( ostream & os, const apstring & str );

There's a rogue semicolon in there that shouldn't be.

ostream & operator << ( ostream & os, const apstring & str );

That should fix your errors. :)

Ravalon
Posting Whiz in Training
213 posts since Dec 2006
Reputation Points: 84
Solved Threads: 15
 

It worked. Thanks.

theflier13
Newbie Poster
4 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 
It worked. Thanks.


Yes! Every once in a long while I guess right. I may even get a reputation for knowing what I'm talking about soon. ;)

Ravalon
Posting Whiz in Training
213 posts since Dec 2006
Reputation Points: 84
Solved Threads: 15
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You