Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2004

Tip: Looking for answers? Try searching our database.

change to <iostream> causing compile errors

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brett - 02 Oct 2004 14:55 GMT
Hi,

I'm compiling an old project under the 'new' visual studio 7.1.3088.

I changed the line:
#include <iostream.h>
to
#include <iostream>

and now I get a stack of errors, some of which are:

stdexcpt.h(56) : error C2143: syntax error : missing ';' before '&'
stdexcpt.h(56) : error C2433: 'ostream' : 'inline' not permitted on data
declarations
stdexcpt.h(56) : error C2501: 'ostream' : missing storage-class or type
specifiers
stdexcpt.h(56) : error C2065: 'os' : undeclared identifier
stdexcpt.h(56) : error C2059: syntax error : 'const'
stdexcpt.h(57) : error C2143: syntax error : missing ';' before '{'
stdexcpt.h(57) : error C2447: '{' : missing function header (old-style
formal list?)

The code for those lines read as follows

inline ostream &operator<<(ostream &os, const mwException &except)
{
if (except.type()) os << except.type() << endl;
const char *file =
(except.source() ? except.source() : "No File Info.");
os << "Exception! File: " << file << ", Line: "
<< except.where() << endl;
os << " " << except.what() << endl;
// Print exception-class-specific message
if (except.post() != 0)
os << except.post() << endl;
return os;
}

I've tried to include <ostream> as well, but that didn't help.

Thanks,
Brett.
Carl Daniel [VC++ MVP] - 02 Oct 2004 15:46 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> to
> #include <iostream>

Add

using namespace std;

And you'll be a lot closer to a drop-in replacement of <iostream.h> with
<iostream>

There may still be a thing or two that needs tweaking (particularly if
you're opening streams and not just using a stream that was handed to you,
like cout or cin).  But add the using declaration and try again, it'll be
easier to spot what else needs to change when you get rid of all the
namespace related noise.

I'm assuming that you're also #includeing <stdexcept.h>, be sure to change
this to #include <stdexcept> as well.

-cd
Brett - 02 Oct 2004 16:09 GMT
Yep, that was it.

You were too quick, I was just about to post to the group to say don't
bother...honest!

Thanks,
Brett.

> > Hi,
> >
[quoted text clipped - 22 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.