Hmmm,
I am puzzled.
I ran the identical code on my box and, as expected, it works just fine. Therefore it's not syntax.
My conclusion is that getline exists on your system, but it seems to be too primitive to support the functionality that we take for granted. Apparently, you just have an...