#include "Library.h"
;void main();
{
// Generic welcome screen.
cout << "\n\nWelcome to WRATH LANDS\n";
cout << "Programmed by Timothy Thompson\n\n";
cout << "An evil demon creature known as the wraith lord has taken control of the\nworld. He controls a vast army of evil creatures who kill people for fun.\nYou must rise against the wraith lord and kill all his minions.\n\n";
Wait();
Crossroads();
cout << "\n\nThank you for WRATH LANDS! Please play again soon.\n\n";
return 0;
}
This has this error:
1>c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\main.cpp(4) : error C2447: '{' : missing function header (old-style formal list?)
#include "Library.h"
//CROSSROADS
//GLOBAL VARIABLES
;bool glcomplete = false;
bool fcomplete = false;
bool scomplete = false;
bool gcomplete = false;
bool ccomplete = false;
bool Crossroads()
{
int choice = 0;
while (choice !=10)
{
cout << "You stand at the center of several roads going off in many directions.\n\n";
cout << "There is a small town behind you full of shops and people.\n\n";
cout << "Which path do you choose?\n";
cout << "1 : Town\n";
cout << "2 : Summoning Portal\n";
if (!glcomplete)
cout << "3 : Grasslands (QUEST)\n";
if (glcomplete && !fcomplete)
cout << "4 : Forest Road (QUEST)\n";
if (fcomplete && !scomplete)
cout << "5 : Swamp Road (QUEST)\n";
if (scomplete && !gcomplete)
cout << "6 : Graveyard Road (QUEST)\n";
if (gcomplete && !ccomplete)
cout << "7 : Castle Road (QUEST)\n";
cout << "10 : Exit Game\n";
cout << ">";
cin >> choice;
switch (choice)
{
case 1:
{
Town();
break;
}
case 2:
{
//SummonPortal();
break;
}
case 3:
{
//if (!glcomplete)
//Grasslands();
break;
}
case 4:
{
//if (glcomplete && !fcomplete)
//Forest();
break;
}
case 5:
{
//if (fcomplete && !scomplete)
//Swamp();
break;
}
case 6:
{
//if (scomplete && !gcomplete)
//Graveyard();
break;
}
case 7:
{
//if (gcomplete && !ccomplete)
//Castle();
break;
}
default: break;
}
returntrue;
}
I get this error:
1>c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\crossroads.cpp(94) : fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\crossroads.cpp(14)' was matched
This is helper.cpp:
1 2 3 4 5 6 7 8 9
#include "Library.h"
//HELPER FUNCTIONS
void Wait();
{
cout << "Press Enter to Continue.\n";
cin.ignore(1);
}
with this error:
1>c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\helper.cpp(6) : error C2447: '{' : missing function header (old-style formal list?)
#include "Library.h"
;void main()
{
// Generic welcome screen.
cout << "\n\nWelcome to WRATH LANDS\n";
cout << "Programmed by Timothy Thompson\n\n";
cout << "An evil demon creature known as the wraith lord has taken control of the\nworld. He controls a vast army of evil creatures who kill people for fun.\nYou must rise against the wraith lord and kill all his minions.\n\n";
Wait();
Crossroads();
cout << "\n\nThank you for WRATH LANDS! Please play again soon.\n\n";
return 0;
}
I get this error
1>c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\main.cpp(20) : error C2562: 'main' : 'void' function returning a value
and this error
1> c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\main.cpp(3) : see declaration of 'main'
#include "Library.h"
//CROSSROADS
//GLOBAL VARIABLES
bool glcomplete = false;
bool fcomplete = false;
bool scomplete = false;
bool gcomplete = false;
bool ccomplete = false;
bool Crossroads()
{
int choice = 0;
while (choice !=10)
{
cout << "You stand at the center of several roads going off in many directions.\n\n";
cout << "There is a small town behind you full of shops and people.\n\n";
cout << "Which path do you choose?\n";
cout << "1 : Town\n";
cout << "2 : Summoning Portal\n";
if (!glcomplete)
cout << "3 : Grasslands (QUEST)\n";
if (glcomplete && !fcomplete)
cout << "4 : Forest Road (QUEST)\n";
if (fcomplete && !scomplete)
cout << "5 : Swamp Road (QUEST)\n";
if (scomplete && !gcomplete)
cout << "6 : Graveyard Road (QUEST)\n";
if (gcomplete && !ccomplete)
cout << "7 : Castle Road (QUEST)\n";
cout << "10 : Exit Game\n";
cout << ">";
cin >> choice;
switch (choice)
{
case 1:
{
Town();
break;
}
case 2:
{
//SummonPortal();
break;
}
case 3:
{
//if (!glcomplete)
//Grasslands();
break;
}
case 4:
{
//if (glcomplete && !fcomplete)
//Forest();
break;
}
case 5:
{
//if (fcomplete && !scomplete)
//Swamp();
break;
}
case 6:
{
//if (scomplete && !gcomplete)
//Graveyard();
break;
}
case 7:
{
//if (gcomplete && !ccomplete)
//Castle();
break;
}
default: break;
}
returntrue;
}
Here is the error I get
1>c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\crossroads.cpp(94) : fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\timbo\my documents\visual studio 2008\projects\game\game\crossroads.cpp(14)' was matched
When a function has it's return type as void, it means that
it does not return a value.
Therefore to say return 0 in the main function is an error. You are returning an integer value
You should change to int main() and keep the return statement.
In crossroads.cpp you are missing the } for the switch statement - so you have three { but only two }.
1 2 3 4 5 6 7 8 9
case 7:
{
//if (gcomplete && !ccomplete)
//Castle();
break;
}
default: break;
} // <---- this end of switch brace is missing