Hi, I wrote part of a program in visual c++, but I use dev c++ at school, so I tried just copying my code:

char mainmenu[50];
char game[50];
int strength;
int intelligence;
int dexterity;
int health;
int mana;
int damage;
int defense;
int k;
int roll;
int experience;
int levelup;

int main () {
	HANDLE hConsole;
int k;
 
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

k = 3;
    
  SetConsoleTextAttribute(hConsole, k);
  
	cout <<"Main menu:  New game, Load game, Exit game" <<endl;
	cin.getline(mainmenu, 50);
	if (mainmenu == "New" || "new" || "New Game" || "new game" || "New game" || "new Game" || "newgame" || "Newgame")
	{
		system("Cls");
	cout <<"Hello, what may I call you by?" <<endl;
	cin.getline (name, 50);
	cout <<"Hello " <<name <<", and welcome to the world of Zelanthia." <<endl;
	Sleep(1500);
	cout <<"Our world has been horribly overrun with monsters, and we need you to help!" <<endl;
	Sleep(2500);
	cout <<"Here is a practice fight for you.";
	Sleep(10000);
	}

But I get errors saying hConsole is undefined
STD_OUTPUT_HANDLE undeclared
expected ; before hConsole
SetConsoleTextAttribute undeclared


And it goes on saying cout, cin, and everything are the same way. I have no idea what files have to be included into the project in dev-c++, as in visual they are already included, help would be great. Thanks ahead of time!

I see no headers included. Presumably you've been relying on the precompiled header stdafx.h that Visual C++ likes to put into projects?

Thanks. That's all I wanted to know, I had to no idea what the precompiled header was for it.

And I must have forgotten to copy the headers, sorry. But no stdafx.h was not one of them.

That's because "stdafx.h" is a VS-specific thing. If you open the actual file, you should see the #include statements for the standard C++ headers that you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.