mardi 27 août 2019

How to compile c++98 code written on RedHat 5 on RedHat 7 Linux

I have a c++ application written and compiled on a RedHat5 Linux machine using NetBeans. (c++ and gcc version 4.1.2) I want to compile it on a RedHat7 machine(c++ and gcc version 4.8.5). My problem is that all functions related to the c++ std library are showing an error.

I tried changing the c++ compiler to c++98 and c++11 but both didn't work. All header includes remained the same.

`// A simple split function that returns vector of double
std::vector<double> ConfigParser::split(std::string combined, char separator){
    std::vector<double> separated;`
    std::replace(combined.begin(), combined.end(), separator, ' ');`
    std::stringstream ss(combined);
    std::string temp;
    while (ss >> temp)
    {
        separated.push_back(atof(temp.c_str()));
    }

    return separated;
}

ConfigParser.cpp:34:5: error: ‘replace’ is not a member of ‘std’

ConfigParser.cpp:39:46: error: ‘atof’ was not declared in this scope

Aucun commentaire:

Enregistrer un commentaire