I have a simple Qt project. I include <memory>
but std::unique_ptr is not available. I know that I should use Qt specific smart pointers but I need to include a larger project that contains std::unique_ptr.
What can I do?
Thanks!
C++11 is required for smart pointers. Depending on your version of Qt:
Add CONFIG += c++11
to your .pro file if you have Qt5 and above. It needs to include <memory>
as Simon mentioned.
If you have an earlier version than Qt5, try adding this:QMAKE_CXXFLAGS += -std=c++11
Include memory:
#include <memory>
Configure your Qt project to use C++11. Add to your .pro file:
CONFIG += c++11
If that does not solve the problem, please add a detailed error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With