|
-
Dec 2nd, 2002, 07:05 AM
#1
Thread Starter
yay gay
old version of c++
hi i am starting with c++ and i have a question
in my book it says that c++ compilers made before of the standartization does not use the "using namespace std;" and that in the begginin of the file they put the extension of the #include like this: include <"iostream.h"> but that now it isnt need anymore...i have visual c++ 6.0 but it seems like an old compiler..anyone could explain me this?
\m/  \m/
-
Dec 2nd, 2002, 07:28 AM
#2
Visual C++ 6 is a new compiler using this measure. It understands the new
#include <iostream>
using namespace std;
but it also understands
#include <iostream.h>
for backwards compability with older code. And unlike VC++7 or gcc 3.x it doesn't warn you about the fact that such code is outdated.
Whenever you're writing new code use the new syntax.
But VC++6 is old in other terms. First, there's a new version out. Second, it is really bad when it comes to templates. It can't even compile this simple code:
Code:
template<typename T>
inline void initStruct(T &s) {
ZeroMemory(&s, sizeof(T));
s.dwSize = sizeof(T);
}
which would be really useful for DirectDraw programming...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 2nd, 2002, 09:19 AM
#3
Monday Morning Lunatic
Can't it? 
I would have expected even VC6 to be able to do that. Yikes; no wonder Ked did so much whining
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 2nd, 2002, 12:09 PM
#4
VC++6 didn't compile it. The version of Borland I had compiled it, but got the sizeof wrong. A version of gcc we had in school (<3.0) did everything right...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 8th, 2002, 08:19 PM
#5
Thread Starter
yay gay
where can i download vc6 new version?
\m/  \m/
-
Dec 9th, 2002, 02:41 AM
#6
"Nowhere".
If you get my meaning...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 9th, 2002, 07:11 AM
#7
Thread Starter
yay gay
ah when u said new version u meant vc++7?
i bough a book about c++ (that says that supports vc++6) but i tryed to compile a bit of code saying hello world and it isn't workin :\
\m/  \m/
-
Dec 9th, 2002, 07:44 AM
#8
Show me that code. I can't imagine a Hello-World app not working in any VC++.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 9th, 2002, 04:06 PM
#9
Thread Starter
yay gay
Code:
// lolololol.cpp : Defines the entry point for the console application.
//
#include "iostream"
using namespace std;
int main()
{
cout << "C++ is power programming";
return 0;
}
\m/  \m/
-
Dec 9th, 2002, 04:08 PM
#10
Thread Starter
yay gay
ah forgot the error :
c:\program files\microsoft visual studio\myprojects\lolololol\lolololol.cpp(14) : fatal error C1010: unexpected end of file while looking for precompiled header directive
\m/  \m/
-
Dec 9th, 2002, 04:13 PM
#11
Addicted Member
You have made the project with precompiled headers. This means that you MUST include
Code:
#include "stdafx.h"
Or whatever the precompiled header is as the first line of every .cpp file in the project. You can turn these off in the project settings.
I think you'll need to replace "iostream" with <iostream>, but parksie or CB will be able to correct me if I'm wrong. Other than that its fine - just need to sort the precompiled header out.
HD
-
Dec 9th, 2002, 04:49 PM
#12
Frenzied Member
Originally posted by HairyDave
Or whatever the precompiled header is as the first line of every .cpp file in the project. You can turn these off in the project settings.
It doesnt have to be the first line. However, any lines preceding it are simply ignored.
Z.
-
Dec 9th, 2002, 04:52 PM
#13
Addicted Member
Originally posted by Zaei
It doesnt have to be the first line. However, any lines preceding it are simply ignored.
Yeah, which is why it finds the end of file while looking for it.
HD
-
Dec 9th, 2002, 05:09 PM
#14
Thread Starter
yay gay
but that's how it is in the book
\m/  \m/
-
Dec 9th, 2002, 05:13 PM
#15
Thread Starter
yay gay
\m/  \m/
-
Dec 9th, 2002, 06:39 PM
#16
Always create an "Empty Project", then you don't need to worry about precompiled headers.
"iostream" is legal, but <iostream> should be preferred. <name> means the compiler should only look in the standard incldue directories, while "name" means it should look first in the current (or project) directories, then in the standard include directories. For standard headers you should use <name>: it avoids the problem of accidently having a header of the same name which would be preferred and lets other people easily find out which standard headers are included.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|