lundi 27 juin 2016

Difficulty compiling c++11 with notepad++

I've been using notepad++ and am using a script to compile files in it:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" -o prog.exe
cmd /c “$(CURRENT_DIRECTORY)\prog.exe”

Which has been fine. But I've now been using something with c++11 functions, so after doing some reading, found I should edit the script like this:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" -std=c++11 -o prog.exe
cmd /c “$(CURRENT_DIRECTORY)\prog.exe”

But I'm still being told that stoi isn't a member of std, which it should be. In my MinGW folder it says I have gcc version 4.8.1.

Other options for -std=c++11 that I read about and tried to use were -std=c++0x and -std=gnu++11. I'm quite new to this so would appreciate any help, thanks!

Code I've been compiling (the excerpt with the stoi use):

int card::getRank(){
    int cardRank;
    if(value.compare("A") == 0){
        cardRank = 11;
    }
    else if(value.compare("J") == 0 || value.compare("Q") == 0 || value.compare("K") == 0){
        cardRank = 10;
    }
    else{
        cardRank = std::stoi(value);
    }
    return (cardRank);
}

Aucun commentaire:

Enregistrer un commentaire