Unable to compile C ++ 11 source using GCC 5.1 dashboard

I am trying to compile a library written with C ++ 11 functions using GCC 5.1 on Ubuntu. However, he complains that he is std::unique_ptrnot defined.

gcc (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0
g++ (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0

CXX flags:

-std=c++11 -Wall -Wextra -Weffc++ -pedantic

Conclusion:

error: ‘unique_ptr’ in namespacestd’ does not name a template type
         std::unique_ptr< detail::RegexImpl > m_pimpl;

However, I can compile the same code on OSX.

Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)

CXX flags:

-stdlib=libc++ -std=c++11 -Wall -Wextra -Weffc++ -pedantic

What am I doing wrong?

+4
source share
1 answer

You are not doing anything wrong. The library source is missing #include <memory>.

. , , , #include , .

#include, , , , .

+13

All Articles