473,772 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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<<(ost ream &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 2164
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.nos pam>
wrote in message news:u$******** ******@TK2MSFTN GP09.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
89406
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 compilation error as #include expect filename. Anu help would be appreciated. thanx, John
1
2469
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 know a solution, please tell me. Thanks, Jürgen
9
2372
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 symbol when i include <iostream.h> with std namespace and <List>
4
5939
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
1592
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, cstdio, cmath and I think cstdlib in g++) Are there any that the standard requires to be "dragged in" like this regardless of implementation?
9
6174
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 reply please.
5
2346
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 reside in the same folder as the project? I know that in java, this is the case. Please help. Thank Wesley
1
2141
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 the library <mcheck.h>. Now the very last bugs I seem to be incapable of eliminating are: - 0x000000000061f460 Free 387310 was never alloc'd 0x2aaaab053b53 - 0x000000000061f040 Free 387311 was never alloc'd 0x2aaaab053b53
1
2054
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 require complete types. As far as I understand, a implementation is free to use a certain amount of compiler magic to be able to declare std::cout etc. without defining basic_ostream. Is this correct? If so, then it would mean that the following...
0
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.