Firstly, I'm pretty new to C++. I believe that getline()
isn't a standard C function, so #define _GNU_SOURCE
is required to use it. I'm now using C++ and g++ tells me that _GNU_SOURCE
is already defined:
$ g++ -Wall -Werror parser.cpp
parser.cpp:1:1: error: "_GNU_SOURCE" redefined
<command-line>: error: this is the location of the previous definition
Can anyone confirm if this is standard, or is its definition hidden somewhere in my setup? I'm not sure of the meaning of the final line quoted.
The file's includes are as follows, so presumably it's defined in one or more of these?
#include <iostream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <list>
#include <sstream>
Thanks!