|
-
Sep 19th, 2000, 12:45 PM
#1
Thread Starter
Hyperactive Member
OK,
I wish there was a smiley that had tears! Can someone help me? I give up. I've installed and uninstalled VC++6 and MSDN 3 times so far and still I can't run this c++ code on my WinNT machine in work. It works at home (Win98) but gives me these errors on the following code:
Here's the code:
#include <iostream>
int main(void)
{
cout << "Does this work?"
<< endl << endl;
return 0;
}
Here's the errors:
--------------------Configuration: NewOne - Win32 Debug--------------------
Compiling...
Cpp1.cpp
D:\Apps\Microsoft Visual Studio\MyProjects\NewOne\Cpp1.cpp(5) : error C2065: 'cout' : undeclared identifier
D:\Apps\Microsoft Visual Studio\MyProjects\NewOne\Cpp1.cpp(5) : error C2297: '<<' : illegal, right operand has type 'char [16]'
D:\Apps\Microsoft Visual Studio\MyProjects\NewOne\Cpp1.cpp(6) : error C2143: syntax error : missing ';' before '<<'
Error executing cl.exe.
NewOne.exe - 3 error(s), 0 warning(s)
-
Sep 19th, 2000, 01:17 PM
#2
Monday Morning Lunatic
It's not a bug, it's a feature. Seriously.
Since you're using the Standard C++ Library (the headers with no extension), you must use
Code:
using namespace std;
somewhere. Here's your code again:
Code:
#include <iostream>
using namespace std;
int main() {
cout << "Does this work?" << endl << endl;
return 0;
}
Alternatively, you can just put std:: in front of cout, or anything else related to the Standard C++ Library.
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
-
Sep 19th, 2000, 01:19 PM
#3
Damn, i was reading the thread and there were no replies, and i thought, YA, I CAN ANSWER THIS ONE AND FINALLY HELP SOME ONE!!!!!!! Then i press reply and theres an answer at the bottom, just a few seconds to late!!!!!
-
Sep 19th, 2000, 09:41 PM
#4
Frenzied Member
How come it was working at home?
Harry.
"From one thing, know ten thousand things."
-
Sep 20th, 2000, 12:44 PM
#5
Thread Starter
Hyperactive Member
I think because of version of library. At home I used my MSDN but at work I downloaded their's. Someone else told me older versions defaulted the headers to like <iostream.h> from <iostream> which also makes it work on my work machine. I upgraded the VC++ to version6 at home. Maybe It kept hold of that stuff???
Either way - Thanks for all the help guys. I'll lic this stuff eventually and maybe someday offer help to others.
Joey O.
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
|