I am currently making a C++ text-based adventure game (without classes! -- I'll learn later). I've had some compiler errors before, but I've always fixed them. This time, however, the problem is much more complex. I see nothing wrong with my code, and I tried reinstalling Microsoft Visual C++ Express 2005 to no avail. The errors started when I added a few more functions to my game. Since I have a template I use for all my functions, that's not the problem. The following is my entire header file and my function template. Sorry for the badly formatted comments!
Code:
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
// Global Application
int main();
int menu(); // Function Menu
int abvh(); // About + Version History
int intr1(); // Name
int intr2(); // Health
int contr(); // Controls
int links(); // Links
int debug(); // Debug
int udbg1; // Variable Debug Accessibilty
bool udbg2; // Debug Selection
bool unme3; // Name Confirmation
bool unme4; // Name Confirmation
bool uhlh2; //Health
string uexit; // Exit
string unme1; // Name
string unme2; // Name Confirmation
string uhlth; // Health
string umenu; // Menu Number
// Global Actions
string ufact; // Variable Action Fight
string ugact; // Game
string uiact; // Inventory
string udact; // Debug
// Global Game
int gintr(); // Function Level Introduction
int fight(); // Fight
int inven(); // Inventory
const int cappl = 3; // Variable Apple Cost
const int cpens = 2; // Pen Cost
const int happl = 3; // Healing Apple
const int helix = 5; // Healing Elixir
int ccont = 1; // Level Completion Count
int udied; // Death Count
int inews; // Inventory Newspaper
int iciga; // Pack of Cigarettes
int iiden; // ID
int ijakt; // Jacket
int iappl; // Apple
int ipens; // Pens
int ikey1; // Peculiar House Key
int ielix; // Elixir
int irsdg; // Rusty Dagger
int ipofa; // Poison Fang
int ibamm; // Boxing Arena Membership
int ileat; // Leather
int ename; // Fight Enemy Name
int umndg; // User Minimum Damage
int umxdg; // User Maximum Damage
int emndg; // Enemy Minimum Damage
int emxdg; // Enemy Maximum Damage
int umndf; // User Minimum Defense
int umxdf; // User Maximum Defense
int emndf; // Enemy Minimum Defense
int emxdf; // Enemy Maximum Defense
int rgold; // Random Gold
int cheff; // Chance of Effect
int ustdr; // User Status Effect Duration
int estdr; // Enemy Status Effect Duration
int dstef; // Damage of Status Effect
float uheal = 50; // Your Health
float money = 10; // Money
float dmage; // Fight Damage
float dfens; // Defense
float eheal; // Enemy Health
string enamc; // Enemy Display Name
string eefct; // Enemy Effect
string uefct; // User Effect
string ustef; // User Status Effect
string estef; // Enemy Status Effect
string uweap; // Equipped Weapon
string uarmr; // Equipped Armor
// Level 1
int l1gp1(); // Function Glen Park 1
int l1gp2(); // Glen Park 2
int l1hs1(); // Howard Street 1
int l1br1(); // Bar 1
int l1br2(); // Bar 2
int l1ii1; // Variable Interaction Item 1
int l1pe1; // Person 1
int l1pe2; // Person 2
int l1pe3; // Person 3
// Level 2
int l2db1(); // Function Domenic Boulevard 1
int l2db2(); // Domenic Boulevard 2
int l2de1(); // Depanneur 1
int l2ho1(); // Shack Door
int l2ho2(); // Shack Kitchen
int l2ho3(); // Shack Closet
int l2ba1(); // Belgrave Avenue 1
int l2sl1(); // Symmetric Lane 1
int l2hs1(); // Howard Street 1
int l2ii1; // Variable Interaction Item 1
int l2ii2; // Item 2
int l2pe1; // Person 1
int l2pe2; // Person 2
int l2pe3; // Person 3
string ul2b1; // Depanneur Selection
// Level 3
int l3vs1(); // Function Victoria Square 1
int l3wa1(); // Werd Alley 1
int l3sw1(); // Sewers 1
int l3ch1(); // City Hall 1
int l3ba1(); // Boxing Arena 1
int l3ba2(); // Boxing Arena 2
int l3er1(); // Echo Road 1
int l3rb1(): // Royal Bank 1
/*1*/int l3am1(); // Amunation 1
/*2-3*/int chlvl; // Variable Challenger Level
int l3pe1; // Interaction Person 1
/* adding l3er1, rb1, am1, and l3pe1 made the compiler go crazy. perhaps there's a limit to the number of functions you can have?*/
/*
int ?() {
do {
ugact = "";
system ( "cls" );
cout << "?" << endl;
cout << "?" << endl;
cout << "What do you do? ";
getline (cin, ugact);
if (udied == 5)
return 0;
if (ugact == "i")
inven();
cin.get();
if (ccont == ?)
return 0;
} while (ugact != "?");
return 0;
}
*/
Errors: (associated with numbers in comments in code)
1-header.h(126) : error C2062: type 'int' unexpected
2-header.h(127) : error C2062: type 'int' unexpected
3-header.h(127) : error C2630: ';' found in what should be a comma-separated list
main.cpp(3) : error C2062: type 'int' unexpected [ when clicked, transports you to : int main() { ]
main.cpp(3) : error C2630: ';' found in what should be a comma-separated list [ see above comment ]
main.cpp(791) : error C2065: 'l3pe1' : undeclared identifier
main.cpp(894) : error C2065: 'chlvl' : undeclared identifier
main.cpp(942) : error C3861: 'l3am1': identifier not found
main.cpp(952) : error C2084: function 'int l3rb1(void)' already has a body
header.h(125) : see previous definition of 'l3rb1'
main.cpp(972) : error C2365: 'l3am1' : redefinition; previous definition was 'formerly unknown identifier'
this warning has always been there -- it's not important
main.cpp(991) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data