0

I've installed latest version of MinGW/MSYS environment. Now I try to activat c++11 standard support. I've added to my cmake script:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x") 

If I try to build a simple test. I got the following compile failure:

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

It seems to me that c++11 support is not set. If I remove the std::shared_ptr declaration from my code and try to compile some code of the chrono library it works. This confuses me. Why some c++11 libraries are supported but core elements like shared_ptr fails?

Do I need to do something extra to enable smart pointers or they are just not there?

4
  • 1
    What compiler do you use exactly? Commented Feb 3, 2013 at 15:17
  • 7
    Did you #include <memory>? Commented Feb 3, 2013 at 15:17
  • 3
    Include the version number in the question. "Latest" won't be accurate for long. Commented Feb 3, 2013 at 15:27
  • Thanks for the hint with the memory include. This was misleadingly out commented Commented Feb 3, 2013 at 16:23

1 Answer 1

2

You can/should (also) use -std=c++0x so as to not enable g++ extension.

Make sure to #include <memory>.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.