Skip to content

Compile issue, "unique_ptr" not defined #2

@markyoder

Description

@markyoder

Specifically, when I run the "make" step of the build process, I get:

src/TwoBit/IO/TwoBitFile.hpp:131:14: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
  131 |         std::unique_ptr<TwoBitSequence> operator[](const std::string& s) const;
      |              ^~~~~~~~~~
src/TwoBit/IO/TwoBitFile.hpp:23:1: note: ‘std::unique_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
   22 | #include <boost/filesystem.hpp>
  +++ |+#include <memory>
   23 | #include <string>
src/TwoBit/IO/TwoBitFile.cpp:153:33: error: no declaration matches ‘std::unique_ptr<TwoBit::TwoBitSequence> TwoBit::TwoBitFile::operator[](const std::string&) const’
  153 | std::unique_ptr<TwoBitSequence> TwoBitFile::operator[](const std::string& s) const
      |                                 ^~~~~~~~~~
src/TwoBit/IO/TwoBitFile.cpp:153:33: note: no functions named ‘std::unique_ptr<TwoBit::TwoBitSequence> TwoBit::TwoBitFile::operator[](const std::string&) const’
src/TwoBit/IO/TwoBitFile.hpp:37:7: note: ‘class TwoBit::TwoBitFile’ defined here
   37 | class TwoBitFile
      |       ^~~~~~~~~~
make: *** [build/TwoBitBuild/src/TwoBit/IO/TwoBitFile.o] Error 1

As the helper suggests (and so do some StackOverflow posts), adding #include into the header file (.hpp) fixes the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions