| pntball650 (4) | |||
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
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 | |||
|
|
|||
| pntball650 (4) | |||
the code is too long so its in segments.....
| |||
|
|
|||
| pntball650 (4) | |||
| |||
|
|
|||
| Duoas (6335) | |
|
Ah, the joys of porting from MSC++... You need to #include <cstdlib> Also, you should be getting some warnings about comparing signed and unsigned values. (For example, line 293 of your last post.) Fix it portably with something like: for ( unsigned i=0; i<(unsigned)v.size(); i++)Hope this helps. | |
|
|
|