error: ‘unique_ptr’ is not a member of ‘std’

Solution 1:

You need to include header where unique_ptr and shared_ptr are defined

#include <memory>

As you already knew that you need to compile with c++11 flag

g++ main.cpp -o run -std=c++11
//                  ^