0

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);
}
Np92
  • 13
  • 4
  • 3
    You forgot to include a [mcve]. – Paul R Jun 27 '16 at 14:05
  • 2
    Did you `#include ` first? – ForceBru Jun 27 '16 at 14:05
  • 1
    Does it compile if you're not using this script? – harald Jun 27 '16 at 14:06
  • Sorry, I put in the code. I am including string, and the code compiles using c++14 in IDEone – Np92 Jun 27 '16 at 14:09
  • 1
    "*gcc version 4.8.1*" Have you considered using a remotely recent version of GCC? That's 3 years old. – Nicol Bolas Jun 27 '16 at 14:10
  • 3
    IIRC MinGW has problems with stoi and won't compile at all if using it. There are some fixes that require you to replace library files but I wasn't able to make it work. Check this question: http://stackoverflow.com/questions/16132176/problems-with-stdstoi-not-working-on-mingw-gcc-4-7-2 – Kegluneq Jun 27 '16 at 14:12

0 Answers0