G++ CAN'T FIND METHOD 'getLine(ifstream, string)'

Mar 7, 2016 at 3:14am
The example use for the function 'getLine' of the c++ standard library, included with 'fstream', is getLine (ifstream, string); .

g++ is telling me it is 'not declared in this scope'.

This is aggrivating me...

I am compiling with MinGW encasing g++.

Please help ASAP.

If you want here's my whole file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main() {
    ifstream _open;
    string data[10000];
    int i = 0;
    _open.open("hi.txt");
    while (!_open.eof()) {
        while (getLine(_open, data[i])) {//RIGHT HERE!!
            i++;
        }
        _open.close();
    }
    for (int i = 0; i < (sizeof(data)/sizeof(data[0])); i++) {
        cout << data[i];
    }
    cin >> data[0];
}


Thanks in advance.
Mar 7, 2016 at 6:30am
getline, not getLine

You'll find no identifiers with capital letters in the standard library.

What does this have to do with Windows?
Mar 8, 2016 at 2:47am
Oh.

Well getLine is what the tutorial page says, I just went with that.

And Windows because I have a gcc enviorment with windows, and have been having quite trouble setting it up. I have had problems with setting the path, which I found out only registers a limited amount of paths because windows is trying to make it 'MS-DOS compatable' (give me a f*ing break). So I was wondering if this wasn't just a syntax error and if I set my enviorment up wrong.

Thanks anyway.
Last edited on Mar 8, 2016 at 3:39am
Mar 8, 2016 at 8:58am
demoylan wrote:
Well getLine is what the tutorial page says, I just went with that.

Which tutorial? If it says getLine with capital L the tutorial needs to be changed.
Last edited on Mar 8, 2016 at 8:59am
Mar 10, 2016 at 2:20am
oh.

Maybe it is just I got confused because the l has a bar under it.

Thanks
Topic archived. No new replies allowed.