VC++ 2005

Pwnbroker

Senior member
Feb 9, 2007
245
0
0
Ok, so I learned VStudio 6.0 in college, went and bought VS05 lateley and I'm trying to come to terms with the subtle and not-so-subtle differences. I created a simple console application in C++ that prints a line of text to the console. It went a little something like this
#include <iostream.h>

int main()
cout<<"blah"<<endl;
return 0;

I got a build error that iostream.h file could not be found...so what would I use instead?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
You're bumping into standard namespaces, which were added to the VC++ build environment... in 2003.Net I think. Anyway, as the previous poster said, iostream.h is now iostream. Just as importantly, all the headers in the standard C++ library are in the std namespace. So the proper fully-qualified description of iostream is std::iostream.
 

Kyteland

Diamond Member
Dec 30, 2002
5,747
1
81
http://www.devx.com/tips/Tip/14447
January 2, 2001

<iostream.h> or <iostream>?

Although the <iostream.h> library was deprecated for several years, many C++ users still use it in new code instead of using the newer, standard compliant <iostream> library. What are the differences between the two? First, the .h notation of standard header files was deprecated more than 5 years ago. Using deprecated features in new code is never a good idea. In terms of functionality, <iostream> contains a set of templatized I/O classes which support both narrow and wide characters. By contrast, <iostream.h> classes are confined to char exclusively. Third, the C++ standard specification of iostream's interface was changed in many subtle aspects. Consequently, the interfaces and implementation of <iostream> differ from <iostream.h>. Finally, <iostream> components are declared in namespace std whereas <iostream.h> components are declared in the global scope. Because of these substantial differences, you cannot mix the two libraries in one program. As a rule, use <iostream> in new code and stick to <iostream.h> in legacy code that is incompatible with the new <iostream> library.
Note the bolded dates. ;)
 

Pwnbroker

Senior member
Feb 9, 2007
245
0
0
So, I guess that means my school, which advertises that they teach today's skills for tomorrow's jobs, are actually teaching yesterday's skills for the jobs that were filled today. This is how they taught us C programming just a year ago.

Thanks for the info guys...

Oh, and should I use "using namespace std" or is that redundant?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: Pwnbroker
So, I guess that means my school, which advertises that they teach today's skills for tomorrow's jobs, are actually teaching yesterday's skills for the jobs that were filled today. This is how they taught us C programming just a year ago.

Thanks for the info guys...

Oh, and should I use "using namespace std" or is that redundant?
C programming is still very valuable, especially for embedded applications.

C++ is a today skill; it is just the complier that you are using.

 

Schadenfroh

Elite Member
Mar 8, 2003
38,416
4
0
C programming is still very valuable, especially for embedded applications.
Indeed, my father (20 year veteran of IT) still uses C every day, his compiler was made in either the late 80s or early 90s and gets the job done. Of course the place he works still uses a good deal of legacy equipment.
 

Pwnbroker

Senior member
Feb 9, 2007
245
0
0
There's a guy that works at my company who still programs in Fortran. That's something I'd like to learn someday since it's a low level language. I've heard it's 10 times harder than C to learn.
 

SoundTheSurrender

Diamond Member
Mar 13, 2005
3,126
0
0
using namespace std; would help.

#include <iostream>
using namespace std;

int main()
{
cout << "\nblah";

return 0;
}