I wrote this program in visual C++ but it has to be able to compile in linux.... Im getting many errors and im not sure what they mean or how to fix them....any help would be greatly appreciated
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
#include <sstream>
using namespace std;
class Character
{
public:
Character(void);
int getIntelligence();
void setLoseIntelligence();
void setGainIntelligence();
void setRandomIntelligence();
int getTime();
void setTime();
double getMoney();
void setPlusMoney();
void setMinusMoney();
void setRandomMoney();
int getLocation();
void setLocation();
void outputCharacter();
void setRandomTime();
int getScore();
int Score();
bool checkAttributes();
private:
int intelligence;
int time;
int location;
double money;
int score;
};
|
the errors i am getting are
jwh0003_1.cpp: In member function 'void System::moveForward()':
jwh0003_1.cpp:158: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void System::quit()':
jwh0003_1.cpp:219: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In function 'int main()':
jwh0003_1.cpp:224: error: 'srand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Menu::output()':
jwh0003_1.cpp:298: error: 'system' was not declared in this scope
jwh0003_1.cpp:309: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In constructor 'Character::Character()':
jwh0003_1.cpp:319: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomIntelligence()':
jwh0003_1.cpp:343: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomTime()':
jwh0003_1.cpp:358: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomMoney()':
jwh0003_1.cpp:378: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'bool Character::checkAttributes()':
jwh0003_1.cpp:412: error: 'system' was not declared in this scope
jwh0003_1.cpp:418: error: 'system' was not declared in this scope
jwh0003_1.cpp:424: error: 'system' was not declared in this scope
jwh0003_1.cpp:430: error: 'system' was not declared in this scope
jwh0003_1.cpp: In member function 'void Encounter::puzzles()':
jwh0003_1.cpp:450: error: 'rand' was not declared in this scope
jwh0003@tux196:~$ jwh0003@tux196:~$ g++ jwh0003_1.cpp -o game
jwh0003_1.cpp: In member function 'void System::moveForward()':
jwh0003_1.cpp:158: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void System::quit()':
jwh0003_1.cpp:219: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In function 'int main()':
jwh0003_1.cpp:224: error: 'srand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Menu::output()':
jwh0003_1.cpp:298: error: 'system' was not declared in this scope
jwh0003_1.cpp:309: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In constructor 'Character::Character()':
jwh0003_1.cpp:319: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomIntelligence()':
jwh0003_1.cpp:343: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomTime()':
jwh0003_1.cpp:358: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomMoney()':
jwh0003_1.cpp:378: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'bool Character::checkAttributes()':
jwh0003_1.cpp:412: error: 'system' was not declared in this scope
jwh0003_1.cpp:418: error: 'system' was not declared in this scope
jwh0003_1.cpp:424: error: 'system' was not declared in this scope
jwh0003_1.cpp:430: error: 'system' was not declared in this scope
jwh0003_1.cpp: In member function 'void Encounter::puzzles()':
jwh0003_1.cpp:450: error: 'rand' was not declared in this scope
-bash: jwh0003@tux196:~$: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void System::moveForward()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:158: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:158:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void System::quit()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:219: error: 'exit' was not declared in this scope
-bash: jwh0003_1.cpp:219:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In function 'int main()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:224: error: 'srand' was not declared in this scope
-bash: jwh0003_1.cpp:224:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void Menu::output()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:298: error: 'system' was not declared in this scope
-bash: jwh0003_1.cpp:298:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:309: error: 'exit' was not declared in this scope
-bash: jwh0003_1.cpp:309:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In constructor 'Character::Character()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:319: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:319:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void Character::setRandomIntelligence()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:343: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:343:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void Character::setRandomTime()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:358: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:358:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void Character::setRandomMoney()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:378: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:378:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'bool Character::checkAttributes()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:412: error: 'system' was not declared in this scope
-bash: jwh0003_1.cpp:412:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:418: error: 'system' was not declared in this scope
-bash: jwh0003_1.cpp:418:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:424: error: 'system' was not declared in this scope
-bash: jwh0003_1.cpp:424:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:430: error: 'system' was not declared in this scope
-bash: jwh0003_1.cpp:430:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp: In member function 'void Encounter::puzzles()':
-bash: jwh0003_1.cpp:: command not found
jwh0003@tux196:~$ jwh0003_1.cpp:450: error: 'rand' was not declared in this scope
-bash: jwh0003_1.cpp:450:: command not found
jwh0003@tux196:~$ clear
jwh0003@tux196:~$ g++ jwh0003_1.cpp -o game jwh0003_1.cpp: In member function 'void System::moveForward()':
jwh0003_1.cpp:158: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void System::quit()':
jwh0003_1.cpp:219: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In function 'int main()':
jwh0003_1.cpp:224: error: 'srand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Menu::output()':
jwh0003_1.cpp:298: error: 'system' was not declared in this scope
jwh0003_1.cpp:309: error: 'exit' was not declared in this scope
jwh0003_1.cpp: In constructor 'Character::Character()':
jwh0003_1.cpp:319: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomIntelligence()':
jwh0003_1.cpp:343: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomTime()':
jwh0003_1.cpp:358: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'void Character::setRandomMoney()':
jwh0003_1.cpp:378: error: 'rand' was not declared in this scope
jwh0003_1.cpp: In member function 'bool Character::checkAttributes()':
jwh0003_1.cpp:412: error: 'system' was not declared in this scope
jwh0003_1.cpp:418: error: 'system' was not declared in this scope
jwh0003_1.cpp:424: error: 'system' was not declared in this scope
jwh0003_1.cpp:430: error: 'system' was not declared in this scope
jwh0003_1.cpp: In member function 'void Encounter::puzzles()':
jwh0003_1.cpp:450: error: 'rand' was not declared in this scope