Im learning c++ and am a noob at it any help would be nice. :) please This is a text based rpg that im messing with. Making a rpg is a great way to learn a language. But any help would be appreciated.
#include <iostream>
using namespace std;
int main()
{
int health, armor, damage;
health = 100;
armor = 0;
damage = 5;// This is a dynamic var for desision making
int loopcon = 1;
int decision = 1;
cout << "You enter the forest and have no idea what has happened and your head hurts.\n";
cout << "You are trying to remember whaT happened to you and how you ended up here but you cant.\n";
cout << "You see a town would you like to explore it?";
cout << "What is your name?";
while (loopcon == 1) {
cout << "1/0";
cin >> decision;
if (decision == 1)
cout << "You enter the city";
if (decision == 0)
cout << "Theres also a forsest want to export that?";
else
cout << "try useing caps";
}
return 0;
}
when I run this is get a big long error any ideas?
sudo gcc maingame.cpp
/tmp/cca53Qhv.o: In function `main':
maingame.cpp:(.text+0x31): undefined reference to `std::cout'
maingame.cpp:(.text+0x36): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0x40): undefined reference to `std::cout'
maingame.cpp:(.text+0x45): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0x4f): undefined reference to `std::cout'
maingame.cpp:(.text+0x54): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0x5e): undefined reference to `std::cout'
maingame.cpp:(.text+0x63): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0x6f): undefined reference to `std::cout'
maingame.cpp:(.text+0x74): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0x80): undefined reference to `std::cin'
maingame.cpp:(.text+0x85): undefined reference to `std::istream::operator>>(int&)'
maingame.cpp:(.text+0x97): undefined reference to `std::cout'
maingame.cpp:(.text+0x9c): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0xad): undefined reference to `std::cout'
maingame.cpp:(.text+0xb2): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
maingame.cpp:(.text+0xbe): undefined reference to `std::cout'
maingame.cpp:(.text+0xc3): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/cca53Qhv.o: In function `__static_initialization_and_destruction_0(int, int)':
maingame.cpp:(.text+0xf7): undefined reference to `std::ios_base::Init::Init()'
maingame.cpp:(.text+0x106): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status