Hi.
I'm completely new to C++, and due to my job, I need to start learning it.
I decided to use OpenWatcom under Windows 10 (if there is a better lightweight alternative, I'm open to suggestions).
I am now in the "basic input/output" part of the tutorial hosted in this same website.
I tried to compile a piece of code as simple as this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
// cin with strings
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string mystr;
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
return 0;
}
|
But the compiler returns me a "
symbol 'getline' has not been declared".
In fact, that piece of code is a literal copy-paste from the tutorials in this website.
But when I run that code on
http://cpp.sh, it works fine, what leads me to think that OpenWatcom doesn't follow a standard C++ or declaration of symbols doesn't follow the expected standards.
Any advice?
Thanks beforehand.