Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. error: 'stoi' is not a member of 'std'
Forum Updated to NodeBB v4.3 + New Features

error: 'stoi' is not a member of 'std'

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 7.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    I'm trying to use a class I wrote and tested as plain c++ program in a Qt app but I'm running through problems. I was able to fix one but don't seem to find the solution to the other problem.

    return std::stoi(recordCount);
    

    the above line is producing error: 'stoi' is not a member of 'std'

    recordCount is a string defined as

    std::string recordCount;
    

    By the way, I compiled and ran the plain c++ program using Qt Creator successfully.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi
      hmm, it should be ?
      http://www.cplusplus.com/reference/string/stoi/
      maybe try the Example ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sandy.martel23
        wrote on last edited by
        #3

        std::stoi() is c++11

        CONFIG += c++11 ?

        mrjjM 1 Reply Last reply
        1
        • S sandy.martel23

          std::stoi() is c++11

          CONFIG += c++11 ?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @sandy.martel23
          good catch!
          if using mingw compiler u need to add
          CONFIG += c++11 to
          your pro file as c++11 support is not enabled pr default for this compiler.

          1 Reply Last reply
          0
          • W Offline
            W Offline
            WhatIf
            wrote on last edited by WhatIf
            #5

            Thank you very much guys :)

            CONFIG += c++11 is what was missing. It was included automatically in the plain c++ program by Qt Creator but not for the gui program.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved