Where's iostream?
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
Try iostream without the .h
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
-
hmm, I'm not sure if my problem's linked, but I'm getting an unidentified identifier error when i try to use cout or endl. (while using #include ) It doesn't seem to effect my program wether or not I include iostream (without the .h) at all. ------------------------------- I'm also having trouble getting string to work.
String Suit1 = "No suit", Suit2 = "No suit";
An error comes up when i run that code, saying I forgot a ; before suit1. and I'm getting syntax error: identifier 'String' whenever it's used in the program other then the initial delaraction of the variables Suit1 and Suit2. I have #include string.h (with arrows, the post acts weird if i put them in) and there seems to be no problems with it, and I've run similar code on VC 6 with no problem. ------------------------------- Am I doing something wrong, or is there a problem with my libraries? =P -
hmm, I'm not sure if my problem's linked, but I'm getting an unidentified identifier error when i try to use cout or endl. (while using #include ) It doesn't seem to effect my program wether or not I include iostream (without the .h) at all. ------------------------------- I'm also having trouble getting string to work.
String Suit1 = "No suit", Suit2 = "No suit";
An error comes up when i run that code, saying I forgot a ; before suit1. and I'm getting syntax error: identifier 'String' whenever it's used in the program other then the initial delaraction of the variables Suit1 and Suit2. I have #include string.h (with arrows, the post acts weird if i put them in) and there seems to be no problems with it, and I've run similar code on VC 6 with no problem. ------------------------------- Am I doing something wrong, or is there a problem with my libraries? =POK. Here's your problem. When the C++ standard was introduced, one thing that was added was namespaces. The standard libraries were placed in namespace std, and the headers that end in .h were deprecated ( i.e. most compilers have them, but they are not standard, they are not part of C++ as define by X3J16 ). So, to use the string class, for example, you must #include. BUT, by doing this, you make part of namespace std visible, which will not give you access to the string class unless you do one of these: using namespace std; // This is really bad, it includes everything in std, i.e. a lot of stuff you don't know about, and which could change in future compilers using std::string; // much better, drag the string class alone ( well, and any iostream operators, but that's another story ) into the global namespace or, in your code: std::string myString; // best of all in terms of segmentation of namespaces, but a bit cumbersome, I'd use it only for things I am only going to define once or twice. Also, String with a capital S is wrong. The string class is all lower case. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
-
OK. Here's your problem. When the C++ standard was introduced, one thing that was added was namespaces. The standard libraries were placed in namespace std, and the headers that end in .h were deprecated ( i.e. most compilers have them, but they are not standard, they are not part of C++ as define by X3J16 ). So, to use the string class, for example, you must #include. BUT, by doing this, you make part of namespace std visible, which will not give you access to the string class unless you do one of these: using namespace std; // This is really bad, it includes everything in std, i.e. a lot of stuff you don't know about, and which could change in future compilers using std::string; // much better, drag the string class alone ( well, and any iostream operators, but that's another story ) into the global namespace or, in your code: std::string myString; // best of all in terms of segmentation of namespaces, but a bit cumbersome, I'd use it only for things I am only going to define once or twice. Also, String with a capital S is wrong. The string class is all lower case. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
Thanks a ton, that cleared a lot of stuff up. That seems strange that my school is teaching me outdated material (damn budget). Anyways, I'm still a little confused as to what I do to use cout or endl. Are there replacements, are they in std, etc.? =P
-
Thanks a ton, that cleared a lot of stuff up. That seems strange that my school is teaching me outdated material (damn budget). Anyways, I'm still a little confused as to what I do to use cout or endl. Are there replacements, are they in std, etc.? =P
Kyle Bishop wrote: That seems strange that my school is teaching me outdated material (damn budget). The problem is rarely the budget, it's that teachers are probably a bunch of old C hackers who actually don't know any better. Kyle Bishop wrote: Anyways, I'm still a little confused as to what I do to use cout or endl. Are there replacements, are they in std, etc.? Yes, the standard headers contain the same stuff, they are just in std. So, to extend my example: #include <iostream> using std::cout; using std::endl; will give you what you're after. As an aside, don't overuse endl, it does more than send a /r/n, it also flushes the stream, so if you use it in tight loops, performance will suffer. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
Check out the VC forum FAQ: 2.1 I'm trying to use a standard C++ library class (like cout, cin, or string) but the compiler gives an undeclared identifier error (C2065) on those names. Why?[^] --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb Magnae clunes mihi placent, nec possum de hac re mentiri.
-
At my school, we're currently using visual C++ (sorry i said visual basic before by mistake). I recently downloaded the new beta versoin of VC++, and it doesn't seem to have iostream.h. I was wondering where I could find a good source for both iostream, and other libraries I may need in the future. =P
Kyle, I don't know if you are using VC++ 6.0 or .net. I also had a similar problem when porting VC++ 6.0 code to 2003 .net. Some kind soul informed me that I should use "iostream" instead of "iostream.h" and it worked! Somehow, MicroSoft dropped the ".h" in later releases of the compiler in this case. Good Luck.
-
Kyle, I don't know if you are using VC++ 6.0 or .net. I also had a similar problem when porting VC++ 6.0 code to 2003 .net. Some kind soul informed me that I should use "iostream" instead of "iostream.h" and it worked! Somehow, MicroSoft dropped the ".h" in later releases of the compiler in this case. Good Luck.
thompsons wrote: Somehow, MicroSoft dropped the ".h" in later releases of the compiler in this case. This is not the case. In fact, when you are using iostream without .h and in angle brackets, you are using STL's iostream. Microsoft dropped support for streams when they first came up with Visual C++.NET Found on Bash.org I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet My Articles