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. [SOLVED]How do I make unique pointers work?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]How do I make unique pointers work?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 6.7k 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.
  • Q Offline
    Q Offline
    qwhos
    wrote on 16 Oct 2014, 13:07 last edited by
    #1

    In my code, I want to use unique pointers. However, I get this error message:

    'unique_ptr' in namespace 'std' does not name a type

    In the code, I have this globally:

    std::unique_ptr<Tools> Engine(new Tools);

    Apparently I have to use C++11, but I already have CONFIG += c++11 in the .pro file.

    So what gives? Does it matter where I put the CONFIG-text in the .pro file?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goblincoding
      wrote on 16 Oct 2014, 13:30 last edited by
      #2

      What errors are you getting? Did you #include<memory> where you're trying to use unique_ptr? You might need to add the following to your .pro (in addition to the CONFIG setting):

      @QMAKE_CXXFLAGS += -std=c++11@

      http://www.goblincoding.com

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qwhos
        wrote on 16 Oct 2014, 13:36 last edited by
        #3

        Ah, I didn't, I completely forgot about that. Thanks for pointing that out!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goblincoding
          wrote on 16 Oct 2014, 13:54 last edited by
          #4

          No problem. If it works, please mark the thread as SOLVED :)

          http://www.goblincoding.com

          1 Reply Last reply
          0

          1/4

          16 Oct 2014, 13:07

          • Login

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