My Dockerfile uses FROM gcc:5
, runs apt-get update and installs CMake v3.9 via wget
. My top-level CMakeLists.txt
has set(CMAKE_CXX_STANDARD 11)
but that doesn't seem to convince gcc to compile using C++11 as I get the following error:
/ifeature.hpp:51:42: error: 'shared_ptr' in namespace 'std' does not name a template type
virtual float compare(const std::shared_ptr<IFeature>& feature) const = 0
^
I tried adding variations of set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
with libstdc++
, gnuc++11
etc. but the compiler does not recognize them. I also tried add_compile_options(-std=c++11)
to no avail. I also tried apt-get upgrade gcc but that didn't help either.
What am I missing here?
For future reference and in the interest of anyone who may encounter this page, I should update that just as @some-programmer-dude mentioned in the comment, simply including <memory>
resolved the error shown in my question.
Given that my original development environment was different from the one in my Docker image and the code was written with different compiler, I had to resolve a few similar issues (missing include files) to satisfy gcc-v5
requirements.