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!

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. :)

It worked. Thanks.

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. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.