473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

change to <iostream> causing compile errors

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.
Nov 17 '05 #1
2 2105
Brett wrote:
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>


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
Nov 17 '05 #2
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.

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:u$**************@TK2MSFTNGP09.phx.gbl...
Brett wrote:
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>


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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John Tiger | last post by:
Can anybody have idea about the difference between #include <iostream.h> and #include <iostream>. Is later one valid statement on any compiler. I tried compiling on MSVC second statement give...
1
by: Juergen Marsch | last post by:
Hi, writing files > 2G with standard library iostream classes results in "... file size limit exeeded." Compiling my program with "-D_FILE_OFFSET_BITS=64" doesn't make any difference. If you...
9
by: ai | last post by:
Hi , I have an application which has to read files of size few mba nd read them into array . Since i am using STL and std namespace to avoid the error error C2872: 'ifstream' : ambiguous...
4
by: aurgathor | last post by:
Howdy, What would be the equivalent of getch() using iostream? My current code is: cout << "\nPress <Enter> to continue..."; getch(); but <conio.h> is not kosher for the C++ class.
1
by: zerotyNONONOTHERESNOSPAMMING!type | last post by:
Hi, As most of you probably already know, depending on which implementation of C++ you have, #include <iostream> may cause various other headers to be #included too. (I've observed cstring,...
9
by: nichas | last post by:
I tried to use #include<iostream> in visual C++ compiler but then it didnt work but i see this is the way it is being mentioned in C++ primer by lippman and lajoie.. where is the problem.. Do...
5
by: wesley | last post by:
Hi All. i am new to C++. I know that in order to use cout, i need to include <iostream>. I have done this, but i still get errors when i try to output to the screen. Is there a file that needs to...
1
by: lars.uffmann | last post by:
Hello everyone! I just debugged a pretty huge project, eliminating basically every memory leak that would occur with the current configuration files, at least according to the mtrace() tool from...
1
by: Old Wolf | last post by:
In a discussion elsewhere, someone wrote: #include <iostreamis not guaranteed to define std::cout, it merely has to declare it as an extern object, and declarations of extern objects do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.