Eclipse Problem

I couldn't find my problem so here goes:

I downloaded Eclipse plus the MinGW files but when I type the following code, it doesn't work and gives errors saying [iostream], [using] and [cout] are undefined :[

1
2
3
4
5
6
7
8
9
10
11
/*Game Over
 by Tomn*/

#include <iostream>
using namespace std;

int main()
{
	cout << ("Game Over!"); /* prints Game Over! */
	return 0;
}


Any solutions to my dilemma?
Last edited on
Preprocessor directives don't end in semicolons.
Heheh, nub question alert: thats the #include right? well, I changed that and still, nothing.
Try changing it to iostream.h
You'll probably get a warning about deprecated headers doing that, though.
Nope, nothing
Personally I can compile it with, or without the .h.

Perhaps you have your IDE set to the wrong language? I don't think most IDEs can even report using as undefined.

for example, using Dev-C++ I can compile the following:

1
2
3
4
5
6
using namespace std;

int main()
{
	return 0;
}


and that doesn't have any include files at all. This leads me to believe something is set wrong in your compiler
Last edited on
Did you play around with the settings, change the directories or header files or something when you installed the IDE?
Does it recognise the #include <iostream> and change the colour after you put it in?
Yeah, I think it's likely you didn't configure properly or at all the IDE, which is why it's not finding the include.
I didn't configure anything, how do you configure it correctly?
What's the correct way of configuring the IDE?
Last edited on
you should type like this
#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
cout << ("Game Over!"); /* prints Game Over! */
return 0;
}
in visual studio C++
Hey, it worked out :)

So to anyone who was wondering, it worked after I made sure the file ended w/ ".cpp" (D'oh!) and after I got some Eclipse updates (Which I got automatically after opening up Eclipse today) :)

Thanks for your guys' help!
Topic archived. No new replies allowed.